I read this answer: Should I declare a function prototype in C?
My question is more specific:
In a program using system calls like access() , open() , creat() , write() , read() ... Do I have to declare every function of the system call? So does C work? Because I get the following:
hw1.c: In function 'main': hw1.c:50:9: warning: implicit declaration of function 'access' [-Wimplicit-function-declaration] hw1.c:131:9: warning: implicit declaration of function 'lseek' [-Wimplicit-function-declaration] hw1.c: In function 'writeFile': hw1.c:159:17: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
Basically, it seems that C is angry with every system call function that I use. I'm a little new to C, and this seems odd to me, although I know that I have to declare the functions I'm writing, I would think that C would know the system call functions and I would not need to explicitly declare them in the code.
I need to do something like this:
int access(const char *pathname, int mode);
If so, why does it make sense? I use other languages ββand should never do this.
source share