Re: just got myself a copy of K&R...
From: Jirka Klaue (jklaue_at_ee.tu-berlin.de)
Date: 11/08/03
- Previous message: Mark Gordon: "Re: [OT] Re: Asking if elements in struct arre zero"
- In reply to: Richard Heathfield: "Re: just got myself a copy of K&R..."
- Next in thread: Mark McIntyre: "Re: just got myself a copy of K&R..."
- Reply: Mark McIntyre: "Re: just got myself a copy of K&R..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 08 Nov 2003 14:11:21 +0100
Richard Heathfield wrote:
> Jirka Klaue wrote:
>> Richard Heathfield wrote:
...
>>>It wouldn't, ever. EOF is what happens when there is no more input.
>>
>>This is the intent, but I think it is not guaranteed, nevertheless.
>>
>>for (;;) {
>> c = getchar();
>> if (feof(f) || ferror(f)) break;
...
> So if your point was that EOF can be returned for a reason other than
> I'm-all-out-of-data, then you're correct - it can also be returned on
> error. Otherwise, I am not sure what your point is.
If all integer types are 32bit wide and CHAR_MAX == INT_MAX, EOF could
be normal data too. That's why my point was, as you noted, that EOF
could be returned for some other reason than end-of-file. Only that I
did have one more reason in mind. :-)
The only reliable method to check for end-of-file seems to be feof(),
doesn't it?
Jirka
- Previous message: Mark Gordon: "Re: [OT] Re: Asking if elements in struct arre zero"
- In reply to: Richard Heathfield: "Re: just got myself a copy of K&R..."
- Next in thread: Mark McIntyre: "Re: just got myself a copy of K&R..."
- Reply: Mark McIntyre: "Re: just got myself a copy of K&R..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|