B
Bartc
The stdin/stdout files of C seem to be always in Text mode.
Is there any way of running a C program so that these (but especially
stdout) are in Binary mode instead?
(I'm in the process of wrapping a different language around C which doesn't
want the concept of text and binary files. But if I output a string such as
"ONE\nTWO\n", this will behave differently between stdout and a regular
(binary) file. Examples on my OS:
"\n" Output 13,10 in text mode; 10 in binary mode
"\w" Output 13,13,10 in text mode; 13,10 in binary mode
(\w is a new escape code equivalent to \r\n). Workarounds will be awkward
(and I could never stop \n expanding to 13,10 for stdout) so would be nice
to avoid them)
Is there any way of running a C program so that these (but especially
stdout) are in Binary mode instead?
(I'm in the process of wrapping a different language around C which doesn't
want the concept of text and binary files. But if I output a string such as
"ONE\nTWO\n", this will behave differently between stdout and a regular
(binary) file. Examples on my OS:
"\n" Output 13,10 in text mode; 10 in binary mode
"\w" Output 13,13,10 in text mode; 13,10 in binary mode
(\w is a new escape code equivalent to \r\n). Workarounds will be awkward
(and I could never stop \n expanding to 13,10 for stdout) so would be nice
to avoid them)