Slimelite BBS

Re: EOF

Back to R25C

From Joseph Walton · 1996-04-06 00:56 · #75224 in R25C

In reply to EOF by Alistair Green

In a message of 24 Mar 96 Alistair Green wrote to All:

 AG> I have recently been writing a program that involves reading ascii
 AG> files one  byte at a time. This is fine until I reach a section of the
 AG> code in the file  that is recognised as the EOF, even though it is not
 AG> the end of the file.
The EOF's about character 26, isn't it? It makes sense to have an unused character marking the end of files, as this character is with text files. However, these are binary files, and you have to handle them as such. You need to change the flags you're passing to fopen() - add a 'b' for binary to the 'r' for reading you're already using.

That is, in case this isn't obvious, fopen("filename", "rb");

That might do it :-)

Joseph Walton
=============

--- Spot 1.3a Unregistered
 * Origin: *Borbah*: "She put the oil in the chain..." (2:251/56.6)