C# : Redirect console application output : How to flush the output?

Posted by user93422 on Stack Overflow See other posts from Stack Overflow or by user93422
Published on 2009-06-23T16:16:53Z Indexed on 2010/06/17 14:43 UTC
Read the original article Hit count: 217

I am spawning external console application and use async output redirect.
as shown in this SO post

My problem is it seems that the spawned process needs to produce certain amount of output before I get the OutputDataReceived event notification.

I want to receive the OutputDataReceived event as soon as possible.

I have a bare-bones redirecting application, and here are some observations:
1. When I call a simple 'while(true) print("X");' console application (C#) I receive output event immediately. 2. When I call a 3d party app I am trying to wrap from the command line I see the line-by-line output.
3. When I call that 3d party app from my bare-bone wrapper (see 1) - the output comes in chunks (about one page size).

What happens inside that app?

FYI: The app in question is a "USBee DX Data Exctarctor (Async bus) v1.0".

© Stack Overflow or respective owner

Related posts about c#

Related posts about console