Am Dienstag, 3. April 2012, 14:11:58 schrieb kibler:
> > This is not the EOF character, this is the EOF return value of getc(),
> > which is -1.  It will be returned when EOF is reached, and is not
> > confused with ^D.
> You miss the point, EOF can be any char, it doesn't matter. What matters
> is that you are telling my program nothing is available, when in fact there
> is one more character - the EOF in this case - and my utilities may be
> waiting for that char to close their processes. Thus our code could hang
> forever waiting for the EOF that never comes.

No, you miss the point. getc() returns a constant called EOF, when it reaches 
the end of file.  This constant is -1.  It is not a character, it is a special 
return value for getc().  This if clause will not filter out any character 
from the input stream, nor will it prematurely declare end of file or 
whatever.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to