Re: problem with binary file
From: Floyd L. Davidson (floyd_at_apaflo.com)
Date: 08/13/05
- Next message: Peter T. Breuer: "Re: problem with binary file"
- Previous message: Peter T. Breuer: "Re: problem with binary file"
- In reply to: Peter T. Breuer: "Re: problem with binary file"
- Next in thread: Peter T. Breuer: "Re: problem with binary file"
- Reply: Peter T. Breuer: "Re: problem with binary file"
- Reply: Grant Edwards: "Re: problem with binary file"
- Reply: JosephKK: "Re: problem with binary file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 13 Aug 2005 12:56:13 -0800
"Peter T. Breuer" <ptb@oboe.it.uc3m.es> wrote:
>Reinardt Behm <reinhardt.behm@t-online.de> wrote:
>> > EOF is -1 which is just a character like any other (255 usually). You
>> > should read untl EOF is _signalled_ from your reader method, not until
>> > it is _read_.
>>
>> This is nonsense. EOF is not a _char_ it is an _int_
>
>Nonsense. Chars are (very short ints). Even shorter than shorts.
Nonsense! EOF is *not* a "just a character", is not data, and
is never 255.
It is a flag returned by the read(2) function, indicating that
an attempt has been made to read past the end of the file.
>> (value 0xffff if int is
>> 16 bit) and you should always read ints from a file to be able to detect
>> EOF.
EOF is not a 16 bit int either. It is a *flag*, and on 32 bit
systems is 32 bits wide, on 64 bit systems is 64 bits wide,
etc. etc.
>You don't seem to understand. EOF will be SIGNALLED, not read. The
>reason why his placing a -1 (char) in the file does not stop the method
>reading beyond the CHAR is because it is a byte like any other.
That is correct. (Which begs the question of why you said it
was 255, usually?)
-- Floyd L. Davidson <http://www.apaflo.com/floyd_davidson> Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
- Next message: Peter T. Breuer: "Re: problem with binary file"
- Previous message: Peter T. Breuer: "Re: problem with binary file"
- In reply to: Peter T. Breuer: "Re: problem with binary file"
- Next in thread: Peter T. Breuer: "Re: problem with binary file"
- Reply: Peter T. Breuer: "Re: problem with binary file"
- Reply: Grant Edwards: "Re: problem with binary file"
- Reply: JosephKK: "Re: problem with binary file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|