linux程序打不开头文件
#include <fcnt1.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
int fd_open,fd_open_create,fd_create;
if((fd_open=open("/home/wang/test/hello.c",O_RDONLY))==-1)
{
perror("open");
exit(EXIT_FAILURE);
}
printf("the file's descriptor is:%d\n",fd_open);
if((fd_open_create==open("./tmp1",O_CREAT|O_EXCL,0644))==-1)
{
perrno("open");
exit(EXIT_FAILURE);
}
printf("the tmp1 file descriptor is:%d\n",fd_open_create);
if((fd_create=creat("./tem2",0644))==-1)
{
perrno("create");
exit(EXIT_FAILURE);
}
printf("the tmp2 file descriptor is:%d\n",fd_create);
close(fd_open);
close(fd_create);
close(fd_open_create);
return 0;
}
编译结果
wangjun@my-desktop:~/test$ gcc -ggdb3 -o open_example open_example.c
open_example.c:1:19: 错误: fcnt1.h:没有该文件或目录
open_example.c: 在函数‘main’中:
open_example.c:8:
相关问答:
为什么我 ioctl(fd,I2C_SLAVE,0x50) 正确,而将0x50改成其他地址都出错?
是不是每增加一个I2C器件,要修改内核代码?
。。。自己解决了。。不同I2C地址,要重新open。。
不过也谢谢楼上的,送分了
......
这里看不懂。。
有这个命令吗?
type d
试试看是不是别名或是函数名
这是在cygwin下运行的,还是看不明白。
输入了 type d 以后变成这样:
看不到图片
没有这个命令,是不是一个 ......
我现在用的是dpch 进行配置的
Perl code:
abc ~ # ifconfig
eth0 Link encap:Ethernet HWaddr 00:1e:ec:c1:94:75
inet addr:10.2.0.144 Bcast:10.2.1.255 Mask:255.255.254.0
......
chmod中的mode_t参数,如何动态的传入值,例如 我要传入0777或0444,但我输入的是字符串 怎么转化为8进制
每个模式均预定义有宏,又因为其实可选分支有限,你可以判断输入得字符串,使用swicth之类得办法,给一临时 ......