c语言向文件中写入

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

FILE *out;
out = fopen("test.txt","a+");
if(out == NULL){
        exit(EXIT_FAILURE);
}
printf("hello~
");
int i;
for(i=0;i<10;i++){
    fprintf(out,"heelo %d
",i);
}
fclose(out);
原文地址:https://www.cnblogs.com/xing901022/p/3626788.html