Mail Archives: djgpp/1998/04/28/06:34:15
On Mon, 27 Apr 1998, Andreas Kochenburger wrote:
> However S_IREAD|S_IWRITE was set for that purpose, which is generally
> used for the default file access modes, at least as far as I know, but
> I am not a C specialist. So I tend to the notion that djgpp has to be
> blamed here, and not the other compilers.
S_IREAD and S_IWRITE don't have anything to do with this problem. The
S_Ixxx bits determine the access rights to the file which is created (if
it doesn't exist already), but they don't say how the program will access
the file. A file can be created to be writable, but a program still can
access it only for reading. Your original program requested a read-only
access to a file that can be written to, so it failed because truncating a
file needs to write to it.
So there's nothing wrong in DJGPP here, you have just used the function
not the way you wanted.
> I don't know if there is a comment on that in the ANSI standard.
ANSI standard doesn't say anything about the `open' function because
`open' is non-ANSI.
- Raw text -