Date: Tue, 28 Apr 1998 13:33:41 +0300 (IDT) From: Eli Zaretskii To: Andreas Kochenburger cc: djgpp AT delorie DOT com Subject: Re: Bug in djgpp 2.8.0b with open()? In-Reply-To: <35445ba9.13407571@news> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.