Re: EOF detection

From: Pascal Bourguignon (spam_at_mouse-potato.com)
Date: 09/14/05


Date: Wed, 14 Sep 2005 13:30:01 +0200

junky_fellow@yahoo.co.in writes:
> Is it guaranteed that if return value of read system call (for
> read request of gerater than 0 bytes) is 0, eof
> has been reached.

Yes.

That is, there was an EOF at that position when read tried to read.
But just a microsecond later, another process may have already written
more bytes to the file and the EOF might already be megabytes further.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein


Relevant Pages

  • Re: Pass a variable to a usage function
    ... > use EOF? ... Tonight you will pay the wages of sin; Don't forget to leave a tip. ...
    (comp.unix.shell)
  • Re: parsing a string
    ... Frank Buss writes: ... There is no worse tyranny than to force a man to pay for what he does not ... -- Robert Heinlein ...
    (comp.lang.lisp)
  • Re: Writing to beginning of file?
    ... With interesting results when the cat process crashes in the middle of ... There is no worse tyranny than to force a man to pay for what he does not ... -- Robert Heinlein ...
    (comp.unix.programmer)
  • Re: Writing to beginning of file?
    ... And why would cat crash? ... There is no worse tyranny than to force a man to pay for what he does not ... -- Robert Heinlein ...
    (comp.unix.programmer)