|
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include "ourhdr.h"
- int
- main(void)
- {
- int fd;
- if((fd=creat("tempfile",FILE_MODE )<0))
- err_sys("creat error");
- if(open("tempfile", O_RDWR)<0)
- err_sys("open error");
-
- if( unlink("tempfile")<0)
- err_sys("unlink error");
-
- printf("file unlinked\n");
- sleep(15);
- printf("done\n");
-
- exit(0);
- }
复制代码
是APUE里的一段code,被我加了个creat之后出问题了
编译能通过,但是我执行后,用ls -l tempfile的时候,说没有这个文件
意思就是我的cret没有起作用,但是系统也不说open error,
就直接说file unlinked,晕~~
希望看过这本书的大哥帮帮忙,谢谢!~!! |
|