Jump to content
  • Advertisement

Archived

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

Nash

Redirect STD out solved but new problem

This topic is 5139 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
The ugly hack: Set up a timer to flush the pipe every 10th/30th/100th of a second.
The nice way: I''m too lazy to look up, but it probably exists.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!