Mail Archives: djgpp/1996/05/24/13:18:26
In article <199605232225 DOT SAA08438 AT delorie DOT com>,
DJ Delorie <dj AT delorie DOT com> wrote:
>> If there is a pre-existing file, which you then try to overwrite
>> using `creat', the first read from the file will return a -1 with
>> errno==EACCESS, instead of a zero-length read.
>
>If you open the file with creat(), you shouldn't be able to read from
>it at all, because it's open only for writing. I think EACCES is the
>right response here.
'man read' on our Solaris 2.3 box says (my emphasis):
EBADF fildes is not a valid file descriptor open
for reading. ^^^^
^^^^^^^^^^^^
And a quick test program bears this out -- read() returns -1 and errno is
set to EBADF. The Microsoft Visual C/C++ help files agree with this.
Olly
--
cool wet grass cool wet grass cool wet grass cool wet grass cool wet grass
- Raw text -