c语言向文件中写入

创建一个文件使用fopen打开,然后使用fprintf输出,最后关闭文件流

FILE *out;
out = fopen("test.txt","a+");
if(out == NULL){
exit(EXIT_FAILURE);
}
printf("hello~\n");
int i;
for(i=;i<;i++){
fprintf(out,"heelo %d\n",i);
}
fclose(out);
上一篇:asp.net+nopi生成Excel遇到设置单元格值null问题


下一篇:解决“UnicodeEncodeError: 'gbk' codec can't encode character u'\xa9' in position 24051: illegal multibyte sequence”错误