创建一个文件使用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);
创建一个文件使用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);