#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int fd=open("/dev/pts/0",O_RDWR);
if(fd==-1)
{
printf("open /dev/pts/0 failed!/n");
exit(0);
}
printf("this file id is %d/n",fd);
char * buf="abc/n";
write(fd,buf,5);
close(fd);
return 0;
}
Linux C 简单低级文件读写(1)
最新推荐文章于 2024-08-02 23:04:43 发布