How to redirect WriteFile func writes to console
-
This smells to me of buffering. I'm guessing your app doesn't call flush() or equivalent on its output file, so the output is buffered until the explicit or implicit close() call at termination. If you can make your app output lots of data, you will probably see it appear in chunks, which will be whatever buffer size is used. The reason it works on the console is that console drivers do not buffer. I have no idea if you can suppress buffering in your redirection, but if you could, my 2c says that would solve your problem. Good luck! Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
Yes standard console output is always buffered. You can actually easily remove it
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);The problem is it will slow the console program down like a dog as each character invokes a full call. I sometimes do it when I have a embedded target with UART debugger like on the Raspberry Pi.
In vino veritas