关于系统调用的open的应用举例

xiaoxiao2021-02-28  104

#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <unistd.h> #include<stdio.h> #include <string.h> #define  SIZE 1024 int main() { int fd =open ("abc",O_RDWR|O_CREAT,0777); if (fd==-1) { perror("open fd"); return -1; } lseek(fd ,20,SEEK_SET); char *buf="hello"; write (fd,buf ,strlen(buf)); close (fd); return 0; }
转载请注明原文地址: https://www.6miu.com/read-71082.html

最新回复(0)