c语言向文件中写入

建立一个文件使用fopen打开,而后使用fprintf输出,最后关闭文件流spa

FILE *out; out = fopen("test.txt","a+"); if(out == NULL){ exit(EXIT_FAILURE); } printf("hello~\n"); int i; for(i=0;i<10;i++){ fprintf(out,"heelo %d\n",i); } fclose(out);
相关文章
相关标签/搜索