做棋牌网站建设哪家好,别墅设计图纸,哪些企业喜欢做网站广告,做产地证网站1、fdopen(int fd, const char *type)的介绍
比如一写特殊文件不能用io打开,我们先要用open函数得到文件描述符,也就是这个fdopen函数的第一个参数,第二个参数是常量,不同类型不同意义,如下图
2、代码演示 #includestdio.h
#includefcntl.hint main…1、fdopen(int fd, const char *type)的介绍
比如一写特殊文件不能用io打开,我们先要用open函数得到文件描述符,也就是这个fdopen函数的第一个参数,第二个参数是常量,不同类型不同意义,如下图 2、代码演示 #includestdio.h
#includefcntl.hint main(void)
{FILE *fp;int fd;if ((fp = fopen("hello.txt", "w+")) == NULL) {printf("fopen file error\n");return 0;}fprintf(fp, "hello word\n");fclose(fp);if ((fd = open("hello.txt", O_RDWR)) == -1) {printf("open file fail\n");return 0;}if ((fp = fdopen(fd, "a+")) == NULL) {printf("