用open函数打开一个文件。比如:
09 char *file = "/home/temp/hello.c ";
10
11 int fd;
12
13 if((fd = open(file, O_RDONLY)) < 0)
14 {
15 printf("open error\n");
16 return -1;
17 }
因为hello.c后边有个空格,导致打开错误,去掉后就正常了!!