Mail Archives: djgpp/2002/06/18/05:33:56
Matthew Mucklo wrote:
>Hello,
>
>I was wondering if anyone knew why MSDOS and stat() therefore return the
>wrong file size. fread() appears to finish ahead of the end of the file as
>according to stat(). It's reporting less characters read than are actually
>in the file (yes, the buffer's big enough).
>
>
>
I think the probeem is that you want to read an MSDOS TEXT file
containing CR\LF pairs which are converted upon reading to a single LF.
Modify this line
> fd = fopen(argv[1], "r");
>
Open the file in binary mode like
fd = fopen(argv[1], "rb");
- Raw text -