#include<stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main (int argc,char ** argv)
{
int fd;
fd=open("test.log",O_RDWR|O_CREAT|O_APPEND,0644);
printf("fd=%d\n",fd);
write(fd,"Hello",5); //fd为文件名,“Hello“为文件内容,5为字符数
return 0;
}
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main (int argc,char ** argv)
{
int fd;
fd=open("test.log",O_RDWR|O_CREAT|O_APPEND,0644);
printf("fd=%d\n",fd);
write(fd,"Hello",5); //fd为文件名,“Hello“为文件内容,5为字符数
return 0;
}