This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: creat and open failing

On Wed, Nov 12, 2003 at 04:31:17PM -0500, wrote:
>I got a question wrt to gcc and cygwin.  I'm not sure if this is the defined
>behaviour, but for some reason, the following code fails.  This is a test
>program which display the failure.  
>Running cygwin on windows 2000.  Compiling with mingw (no-cygwin option) 
>Basically, after creat...close...  the file is set to read only (check
>attributes under windows).  This causes the second to fail.  On the second run
>of the program, the creat fails as well.  Any idea why the file is being set to
>read only?  
>#include <io.h>
>#include <stdio.h>
>#include  <fcntl.h>
>int main()
>   int handle;
>   handle= creat("hello.txt", O_WRONLY);

This isn't the correct argument for creat.  The second argument is
the mode, as in what you send to chmod (2).
Please use the resources at rather than sending personal email.
Special for spam email harvesters: send email to
and be permanently blocked from mailing lists at

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]