C语言文件写入代码示例:向test1.txt写入字符串
#include <stdio.h> #include <stdlib.h>
int main(){ FILE *fp1;
fp1 = fopen('test1.txt', 'w');
if (fp1 == NULL){
printf('Can't open file!
'); exit(1); }
fprintf(fp1, 'Hello,world!');
fclose(fp1);
return 0;
}
原文地址: https://www.cveoy.top/t/topic/pko4 著作权归作者所有。请勿转载和采集!