C语言 简单的文件操作 写文件
#include <stdio.h> #define BUFSIZE 50 int main() { FILE* f; char buf[BUFSIZE] = "this is fputs function!\n hello fputs!"; f=fopen("D:\\1.txt","w"); if(NULL == f) { printf("write file failed!"); } fputs(buf,f); fclose(f); }
#include <stdio.h> #define BUFSIZE 50 int main() { FILE* f; char buf[BUFSIZE] = "this is fputs function!\n hello fputs!"; f=fopen("D:\\1.txt","w"); if(NULL == f) { printf("write file failed!"); } fputs(buf,f); fclose(f); }