What is wrong?

Doug Gwyn gwyn at smoke.BRL.MIL
Wed Jan 25 07:40:10 AEST 1989


In article <2051 at ndsuvax.UUCP> numork at ndsuvax.UUCP (James Mork) writes:
-    j=putc(i,fi);
-  a simple program like this, the file gets truncated after 25 or
-  26 bytes...    After 25 when I read the file back in, I just
-  get EOF (-1).  What is wrong?

Sounds to me like a ^Z in a text stream is taken as an EOF indicator.
I know CP/M had this misfeature; maybe PC-DOS does too.

You probably should have been using binary streams instead.
I.e. fopen with mode "wb" or "rb".



More information about the Comp.lang.c mailing list