我用while,getline的方法读一个28kb的c文件,可总是读不全,一共360多行的内容只能读两百多行,读的多了前面的内容就丢失了,这是什么问题?
什么叫前面的内容丢失了??
#include <stdio.h>
int main(int argc, char* argv[])
{
FILE* fp_in = fopen("input.txt","r");
FILE* fp_out = fopen("output.txt","w");
while (!feof(fp_in)){
char buf[1024] = {0};
fgets(buf, 1023, fp_in);
printf("read: %s\n|, buf);
fprint(fp_out, "%s\n", buf);
}
fclose(fp_in);
fclose(fp_out);
return 0;
}