Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Apr 1996 08:50:47 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        koshy@india.hp.com, nate@sri.MT.net
Cc:        hackers@freebsd.org
Subject:   Re: Critical stdio bug?
Message-ID:  <199604122250.IAA03590@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>nw> OS's, but I had them available).  However, on FreeBSD the EOF doesn't
>nw> get flushed out when it's read.

This is normal (wrong) BSD behaviour.  EOF is sticky, even on a terminal.
You have to clear the EOF using clearerr().  See the getc man page.

>The manual page says:
                ^ for read()

>	The system guarantees to read the number of bytes requested if 
>	the descriptor references a normal file that has that many bytes 
>	left before the end-of-file, but in no other case.
>	[...]
>	If successful, the number of bytes actually read is returned. Upon read-
>	ing end-of-file, zero is returned.  Otherwise, a -1 is returned and the

Input using stdio is quite different from input using read(), unfortunately.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604122250.IAA03590>