delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/27/06:19:20

Date: Mon, 27 Apr 1998 13:14:47 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Gerhard W. Gruber" <g DOT gruber AT sis DOT co DOT at>
cc: djgpp AT delorie DOT com
Subject: Re: Problem with read()
In-Reply-To: <35443AEB.7115C264@sis.co.at>
Message-ID: <Pine.SUN.3.91.980427130701.23236B-100000@is>
MIME-Version: 1.0

On Mon, 27 Apr 1998, Gerhard W. Gruber wrote:

> I seek to position 5 of the file and call read with read(hdl, buffer,
> 4096). The result of read should be the number of bytes actually read or -1
> if an error occured. In this case it should return 5 bytes, because the
> remainder of the file is 5 bytes, but I get -1.

Please post the shortest complete program which exhibits this behavior.

> I thought that the standard says that reading beyond the EOF is not an 
> error condition. 

Which standard did you have in mind?  `read' is only standard in Posix, 
ANSI doesn't have it.  I don't have Posix handy, so can you tell what 
does it say in that case?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019