hello everybody!
I want to create a file with permissions for read, write, and execute to everybody using C, so I write this code:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(){
int fileDescriptor;
fileDescriptor = open("./NewFile", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
printf("File Descriptor: %d\n", fileDescriptor);
close(fileDescriptor);
return 0;
}
I expected to have the following result:
$ ls -l NewFile
-rwxrwxrwx 1 csnmgeek csnmgeek 0 2007-11-15 09:23 NewFile
but instead I got this:
$ ls -l NewFile
-rwxr-xr-x 1 csnmgeek csnmgeek 0 2007-11-15 09:23 NewFile
Can you tell me where is the problem?
regards
jorge