The correct way to open a read/write file in Windows is
f = open ("commit.tmp", O_RDWR | O_CREAT, S_IREAD | S_IWRITE);
It will work fine for our tests.
Copied from MSDN:
int _open( const char *filename, int oflag [, int pmode] );
The pmode argument is required only when _O_CREAT is specified. If the file
already exists, pmode is ignored. Otherwise, pmode specifies the file
permission settings, which are set when the new file is closed the first