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:
相关问答:
我要修改一个Linux程序中的一个字符串,目的串比原来的长,所以直接替换程序无法运行,要怎么办才能使程序正常运行?
不明白你要干什么 改什么程序?
一个手机上的模拟器,本来是在/mmc/mmca1下创建Roms文件夹, ......
我没有安装操作系统的经验,即使是WINDOWS。现在想在LINUX操作系统大环境下学C语言,又要买本本,请问如果操作系统安装不当,会不会对电脑造成什么大的破坏?有没有必要先买一个二手电脑练一下LINUX的 ......
我在安装redhat9的时候有些服务没选,比如samba,http,ntfs,telnet现在不想重装系统了,请问该怎么做?
我在添加/删除应用程序中装了samba,但是重启之后,在“系统设置-服务器设置”中怎么还没出现samba服务器 ......
写了个简单的兩数比较的程序,可是gcc就是编译不过,提示a.c:13: 错误:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘main’的错误,看了又看觉得没有语法错误, ......