yeah, Im on man open(2), Im confused about what to do with multiple modes for open.
Code:
#include <sys/types.h> //Specified in man 2 open
#include <stdlib.h>
#include <errno.h> //Allows use of error numbers
#include <fcntl.h> //Specified in man 2 open
#include <stdio.h>
int main(int argc, char *argv[]){
int fd;
fd = open(argv[1], O_CREAT, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
return 0;
}
gives me errors. open is what I want, eventually, I will develop device drivers. That really doesn't matter though.
heres my errors, this thing is acting like its never seen the open modes before...
Code:
gcc -Wall -o "createFile775" "createFile775.c" (in directory: /home/h/Desktop/cpro)
createFile775.c: In function ‘main’:
createFile775.c:12: error: ‘S_IRWXU’ undeclared (first use in this function)
createFile775.c:12: error: (Each undeclared identifier is reported only once
createFile775.c:12: error: for each function it appears in.)
createFile775.c:12: error: ‘S_IRWXG’ undeclared (first use in this function)
createFile775.c:12: error: ‘S_IROTH’ undeclared (first use in this function)
createFile775.c:12: error: ‘S_IXOTH’ undeclared (first use in this function)
Compilation failed.
Bookmarks