对/tmp文件打开失败
先贴测试代码
#include <sys/types.h>
2 #include <sys/stat.h>
3 #include <fcntl.h>
4 #include <unistd.h>
5
6
7 int main()
8 {
9 int res;
10 res = open ("/tmp/test", O_RDONLY);
11 if (res == -1)
12 {
13 write (1, "wrong\n", 4);
14 }
15 else
16 {
17 write (1, "open\n", 5);
18 }
19 }
这个程序就是打开在临时文件夹打开一个文件
但res总是为-1
就是打开错误,不明白