Click here to Skip to main content
15,908,444 members
Home / Discussions / C#
   

C#

 
GeneralProblem reading process.standardout Pin
CoffeeZombie31-Mar-05 0:11
CoffeeZombie31-Mar-05 0:11 
I'm getting a weird problem while reading the standard output from a process I've created while its running. The console output from the process is A, B, C, D, E but for some reason I am getting the output from standard out as A, B, C, E, D. Has anyone encountered this before?

I'm using a separate thread to read standard out and push the results to a Queue which is then read by the main application and displayed in a text window.

Writing to the Queue in the thread:
ConsoleLine = null;
while( (ConsoleLine MyProcess.StandardOutput.ReadLine()) != null )
{
ConsoleLine += System.Environment.NewLine;
lock( m_OutputQueue.SyncRoot )
{
m_OutputQueue.Enqueue( ConsoleLine );
}
ConsoleLine = null;
}


Reading from the Queue and updating application:
do
{
while( (StdStreamReader.m_OutputQueue.Count>0) && (i<5) )
{
// get output from queue
ConsoleLine = StdStreamReader.m_OutputQueue.Dequeue() as string;
//process output
if( globals.ProcessBuildOutput( ConsoleLine ) )
{
bErrors = true;
}
i++;
}
// let the app do some housekeeping
Application.DoEvents();
//Give the process some room to breath
System.Threading.Thread.Sleep( 100 );
}while( !MyProcess.HasExited );

GeneralRe: Problem reading process.standardout Pin
Sebastian Schneider31-Mar-05 0:43
Sebastian Schneider31-Mar-05 0:43 
GeneralRe: Problem reading process.standardout Pin
Sebastian Schneider31-Mar-05 0:48
Sebastian Schneider31-Mar-05 0:48 
QuestionHow to obtain the server name of the one machine or the office land online SQL SERVER200 0 Pin
prochf31-Mar-05 0:07
prochf31-Mar-05 0:07 
AnswerRe: How to obtain the server name of the one machine or the office land online SQL SERVER200 0 Pin
prochf31-Mar-05 20:12
prochf31-Mar-05 20:12 
GeneralNeed code of email verification in win form Pin
oohungoo30-Mar-05 22:48
oohungoo30-Mar-05 22:48 
GeneralRe: Need code of email verification in win form Pin
Dave Kreskowiak31-Mar-05 5:48
mveDave Kreskowiak31-Mar-05 5:48 
GeneralRe: Need code of email verification in win form Pin
oohungoo31-Mar-05 22:27
oohungoo31-Mar-05 22:27 
GeneralRe: Need code of email verification in win form Pin
Dave Kreskowiak1-Apr-05 2:03
mveDave Kreskowiak1-Apr-05 2:03 
Questionhow convert matlab to C# windows application Pin
audaialghzawi30-Mar-05 21:58
audaialghzawi30-Mar-05 21:58 
Generalpropertygrid Pin
ingwaar30-Mar-05 19:29
ingwaar30-Mar-05 19:29 
GeneralRe: propertygrid Pin
spif200130-Mar-05 20:13
spif200130-Mar-05 20:13 
GeneralRe: propertygrid Pin
the last free name30-Mar-05 20:50
the last free name30-Mar-05 20:50 
GeneralRe: propertygrid Pin
ingwaar30-Mar-05 21:10
ingwaar30-Mar-05 21:10 
QuestionHow do you add a TreeView to a DataGrid? Pin
whather30-Mar-05 18:17
whather30-Mar-05 18:17 
GeneralTextbox event Pin
chettu30-Mar-05 17:42
chettu30-Mar-05 17:42 
GeneralRe: Textbox event Pin
S. Senthil Kumar30-Mar-05 19:10
S. Senthil Kumar30-Mar-05 19:10 
QuestionHow to start SQL Server 2000 Pin
rroobb30-Mar-05 17:27
rroobb30-Mar-05 17:27 
AnswerRe: How to start SQL Server 2000 Pin
Anonymous31-Mar-05 16:57
Anonymous31-Mar-05 16:57 
Generalstructure Pin
LeeeNN30-Mar-05 13:35
LeeeNN30-Mar-05 13:35 
GeneralRe: structure Pin
Christian Graus30-Mar-05 14:34
protectorChristian Graus30-Mar-05 14:34 
GeneralRe: structure Pin
LeeeNN30-Mar-05 14:43
LeeeNN30-Mar-05 14:43 
GeneralRe: structure Pin
Christian Graus30-Mar-05 15:04
protectorChristian Graus30-Mar-05 15:04 
GeneralRe: structure Pin
Sebastian Schneider30-Mar-05 21:10
Sebastian Schneider30-Mar-05 21:10 
GeneralRe: structure Pin
Mathew Hall31-Mar-05 3:26
Mathew Hall31-Mar-05 3:26 

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.