用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后边有个空格,导致打开错误,去掉后就正常了!!
看见标题才进来的,留个脚印
嘿嘿,这个的确需要注意!
一个小小的空格,发现还极为困难。