我必须编写一个简单的程序,将16个字节的数据输出到0和48位的文件,并提出了这个程序:
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
int f = create("test.tmp",774);
if(f>0)
{
write(f,"DEPARTMENT OF CS",16);
lseek(f,48,SEEK_SET);
write(f,"DEPARTMENT OF IS",16);
}
return 0;
}
这有什么问题?它告诉我何时使用cc 7a.sh -ll
编译:
未定义以引用'create'
答案 0 :(得分:6)
没有名为create
它名为creat
答案 1 :(得分:1)
#include <stdio.h>
int main ()
{
FILE * pFile;
pFile = fopen ( "example.txt" , "w" );
fputs ( "This is an apple." , pFile );
fseek ( pFile , 9 , SEEK_SET );
fputs ( " sam" , pFile );
fclose ( pFile );
return 0;
}