• Advertisement

Archived

This topic is now archived and is closed to further replies.

Redirect STD out solved but new problem

This topic is 5023 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I finally found a way to redirect the standard out to a pipe. It involved using the SetStdHandle func on the handle returned from CreateFile when I connected to the pipe. However I have a new problem. When I set the buffer to zero (setvbuf), my printf statements send one character at a time to my pipe server app. When I set a defined buffer size (lets say 1024), the characters aren''t sent until either I have a full 1024 or I call flush(stdout). I could call define a large buffer and call the flush func after each printf, but it would defeat the whole idea. I wanted to change as little as possible on the original app. Is there a way to make the buffer flush after each printf without flush? Or must I change the way I read the pipe on the server side (alter the way I call ReadFile maybe)? Thanks

Share this post


Link to post
Share on other sites
Advertisement
#define PRINTF(bla) printf(bla);\
/*flush, however you like to*/;

Share this post


Link to post
Share on other sites

  • Advertisement