delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/27/14:14:13

From: kochenbu AT no DOT spam DOT de (Andreas Kochenburger)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Bug in djgpp 2.8.0b with open()?
Date: Mon, 27 Apr 1998 10:29:21 GMT
Organization: Another Netscape News Server User
Lines: 52
Message-ID: <35445ba9.13407571@news>
References: <353b0193 DOT 4405066 AT news> <01bd6ea4$8eaf7fc0$ad887fc0 AT tanes>
NNTP-Posting-Host: kh17046d.r30x.khe.scn.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Yes, Thank you. Eli Zaretskii had also been so kind as to point out
this djgpp solution by mailing me directly.

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.

I don't know if there is a comment on that in the ANSI standard.

Andreas


On Thu, 23 Apr 1998 06:28:44 -0400, "Tanes Sriviroolchai"
<tanes AT thaipo DOT thailand DOT ncr DOT com> wrote:

>	I don't know why. However, if you have O_RDONLY, O_WRONLY or O_RDWR ORed
>with "mode", it works fine.
>						Tanes Sriviroolchai
>
>Andreas Kochenburger <kochenbu AT no DOT spam DOT de> wrote in article
><353b0193 DOT 4405066 AT news>...
>> Is this a bug in djgpp (downloaded freshly from www.delorie.com).?
>> 
>> The problem occurs when you run open.exe twice,
>> i.e. open.tst already exists.
>> 
>> /* -----------------------------------------------------
>>     OPEN.C - create or recreate a file
>> 
>>    it works with TC, lcc, gcc 2.8.1
>> 
>>    but not with djgpp 2.8.0.b Why?
>> 
>>    ----------------------------------------------------- */
>> 
>> #include <stdio.h>
>> #include <io.h>
>> #include <fcntl.h>
>> #include <sys\stat.h>
>> 
>> int main() {
>>    int code, mode;
>>    mode = O_CREAT | O_TRUNC;
>>    code = open("open.tst",mode,S_IREAD|S_IWRITE);
>>    printf("\nFile open return code: %d ",code);
>>    if (code < 0) printf("(faulty)\007");
>>    return(0);
>> }

++++ If you like to reply directly by email, please ++++
++++ replace in the address: khe <- no, scn <- spam ++++

- Raw text -


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