hi I am just write a simple program(c.c) :
I can build it with gcc -o c c.c,it 's no error but when exec it ,it can't write the string in the file 'dream.txt' . when i rebuild it with 'gcc -Wall -o c c.c',It print that:Code:#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> int main() { int fp; char * pathname = "/dream/dream.txt"; if((fp=open(pathname,O_WRONLY))==-1) printf("error in open file\n"); write(fp,pathname,11); close(fp); return 0; }
can you tell me why?Code:c.c: In function ‘main’: c.c:14: warning: implicit declaration of function ‘write’ c.c:15: warning: implicit declaration of function ‘close’
Thanks !!



LinkBack URL
About LinkBacks



