What is wrong?
Tim Meighan
tcm at srhqla.UUCP
Fri Jan 27 06:01:58 AEST 1989
In article <8828 at alice.UUCP> ark at alice.UUCP (Andrew Koenig) writes:
>In article <2051 at ndsuvax.UUCP>, numork at ndsuvax.UUCP (James Mork) writes:
>> I am using TC 1.5 everything was going OK... Now... when I run
>> a simple program like this, the file gets truncated after 25 or
>
>Some MS-DOS C compilers treat a ^Z character as end of file.
My understanding is that the end-of-file indication is being generated
by DOS and returned to the program; the compiler has nothing to do with
it. This happens when the file is opened in text rather than binary
mode, which causes DOS to interperet ^Z as an EOF marker, among other
things. In binary mode, DOS passes all characters without interpretation.
Also, I noticed a suggestion in another posting that James use fopen()
to solve the problem. This could mean re-writing a lot of code, since
fopen() and open() use different file handling techniques. While I am
not familiar with the TC compiler, it should allow you to open() a file
in binary with the "b" argument thus:
fp=open("MYFILE.TXT","r+b");
Tim Meighan
Network Operations
Silent Radio
More information about the Comp.lang.c
mailing list