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/pkpj 著作权归作者所有。请勿转载和采集!