Archived

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

Nash

Redirect STD out solved but new problem

Recommended Posts

Nash    122
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