gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] problem with gforth7 and serial access


From: Bernd Paysan
Subject: Re: [gforth] problem with gforth7 and serial access
Date: Tue, 03 Apr 2012 23:21:33 +0200
User-agent: KMail/4.7.2 (Linux/3.1.9-1.4-desktop; KDE/4.7.2; x86_64; ; )

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

[Prev in Thread] Current Thread [Next in Thread]