Click here to Skip to main content
15,923,142 members
Home / Discussions / C#
   

C#

 
AnswerRe: Repost Pin
Keith Barrow26-Dec-10 23:13
professionalKeith Barrow26-Dec-10 23:13 
GeneralRe: Repost Pin
#realJSOP27-Dec-10 1:26
professional#realJSOP27-Dec-10 1:26 
GeneralRe: Repost Pin
_Erik_27-Dec-10 4:11
_Erik_27-Dec-10 4:11 
QuestionRe: Repost Pin
abbd26-Dec-10 22:35
abbd26-Dec-10 22:35 
GeneralRe: Repost Pin
Keith Barrow26-Dec-10 23:15
professionalKeith Barrow26-Dec-10 23:15 
GeneralRe: Repost Pin
Pete O'Hanlon26-Dec-10 23:49
mvePete O'Hanlon26-Dec-10 23:49 
GeneralRe: Repost Pin
#realJSOP27-Dec-10 1:28
professional#realJSOP27-Dec-10 1:28 
GeneralRe: Repost Pin
thatraja27-Dec-10 8:08
professionalthatraja27-Dec-10 8:08 
GeneralRe: Repost Pin
Pete O'Hanlon27-Dec-10 9:34
mvePete O'Hanlon27-Dec-10 9:34 
GeneralRe: Repost Pin
Keith Barrow28-Dec-10 1:40
professionalKeith Barrow28-Dec-10 1:40 
Questionmodify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 5:24
abbd26-Dec-10 5:24 
AnswerRe: modify XmlDictionaryReaderQuotas Pin
Henry Minute26-Dec-10 6:11
Henry Minute26-Dec-10 6:11 
AnswerRe: modify XmlDictionaryReaderQuotas Pin
Keith Barrow26-Dec-10 6:11
professionalKeith Barrow26-Dec-10 6:11 
QuestionRe: modify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 6:53
abbd26-Dec-10 6:53 
AnswerRe: modify XmlDictionaryReaderQuotas Pin
Keith Barrow26-Dec-10 7:08
professionalKeith Barrow26-Dec-10 7:08 
Questionmodify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 7:19
abbd26-Dec-10 7:19 
QuestionRe: modify XmlDictionaryReaderQuotas Pin
Keith Barrow26-Dec-10 7:27
professionalKeith Barrow26-Dec-10 7:27 
QuestionRe: modify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 7:30
abbd26-Dec-10 7:30 
AnswerRe: modify XmlDictionaryReaderQuotas Pin
Keith Barrow26-Dec-10 7:59
professionalKeith Barrow26-Dec-10 7:59 
QuestionRe: modify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 8:04
abbd26-Dec-10 8:04 
QuestionRe: modify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 23:18
abbd26-Dec-10 23:18 
QuestionRedirecting standard output of an application Pin
TcachTcachTcach25-Dec-10 21:36
TcachTcachTcach25-Dec-10 21:36 
AnswerRe: Redirecting standard output of an application Pin
Abhinav S25-Dec-10 23:18
Abhinav S25-Dec-10 23:18 
GeneralRe: Redirecting standard output of an application Pin
TcachTcachTcach26-Dec-10 0:26
TcachTcachTcach26-Dec-10 0:26 
AnswerRe: Redirecting standard output of an application Pin
Luc Pattyn26-Dec-10 1:57
sitebuilderLuc Pattyn26-Dec-10 1:57 
I'm not sure, but here is my best guess:

it is all about the definition of "new line".

On Windows systems, a native C/C++ program creates a "new line" by outputting a \n which basically is the ASCII linefeed; Windows however by default wants a carriagereturn+linefeed, therefore most run-times will expand \n to \n\r automatically.

Again on Windows systems, a managed code program uses \n\r as newline string, see Environment.NewLine (Note: Mono on Unix would simply use \n here).
For serial ports, the user can set a different newline string, see SerialPort.NewLine
For streams, like you are using, there is no such facility.

Now my guess is that your C program, writing to a stream rather than a real output device (such as the console), doesn't get itsn expanded to \n\r, which your managed code is looking for; therefore the output is not multi-line, and only gets captured when the producer terminates.

If all the above applies, then these are some solutions:

1.
replace every \n by \n\r in your producer (C code)

2.
or stop using all the line-oriented stuff (the DataReceived handlers and the ReadLine method) in your consumer; instead use a thread with a loop, and read arbitrary strings. Note: two threads would be required if you wanted to deal with real-time stdout and stderr.


FWIW: the situation may get more complicated when you are on a virtual system; I have been told Citrix for example does not handle interprocess streams properly (although it might have been a \n versus \n\r issue there too).

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Season's Greetings to all CPians.


modified on Sunday, December 26, 2010 10:49 AM

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.