Compress -c produces the output to the stdout, which is
defined as text file in DOS/Windows. If binary file
compressed contains 0A byte, the runtime automatically
adds the 0D.
file ncompress-4.2.4, file compress42.c, near line 1147
setmode (1, O_BINARY); /* reset the binary mode
for stdout */
(This compiles in MS Visual Studio 6.0)
Fine tunings can be done, by checking whether the
stdout is redirected on console or a file
Log in to post a comment.