Mail Archives: djgpp/1995/07/25/01:08:24
On Mon, 24 Jul 1995 kagel AT quasar DOT bloomberg DOT com wrote:
> Try closing stdin/stdout and reopening with mode set to binary:
>
> fclose( stdin );
> stdin = fopen( "STDIN", "rb" );
> fclose( stdout );
> stdout = fopen( "STDOUT", "wb" );
>
> I believe that the DJGPP library supports these symbolic file names. If not
> you could try opening both stdin and stdout on the CON: device.
There is no "STDOUT" and such. The above method is a bad idea because
stdin/stdout might have been redirected to another file/device. Use
setmode() library function on the file handle, like this:
setmode(fileno(stdout), O_BINARY);
or, if you are sure stdout wasn't freopen()'ed, you can even do this:
setmode(1, O_BINARY);
- Raw text -