Trouble Writing To File
I am trying to write to a text file but I believe my permissions on the directory are incorrect and so are not allowing me to do so. My return value that write() returns is a number greater than 0 and appears to be the number of bytes which I am trying to write and the file is successfully created. However, when I run "ls -l" on this file I see that there are no permissions set what so ever and there is no data in the file. My open call is using the flags O_RDWR | O_CREAT also
You mean the first part of ls -l output is "--------"? That would be a problem (and sort of strange).
Originally Posted by NuNn
You can't directly set the mode with open (you can with fopen), so you have to use chmod()
Maybe post your whole open line...
Yep, MK that is what the output is on the ls command. I am locking the server program itself to ensure there are no more than one copy of it running at a time but this shouldn't have any effect on the creation of this file would it?