急急!!!求助
这个程序void merge_day()
{
char file[256];
char line[512];
const char* format = "d:\\data\\200706_%02d_CG%c.txt";
const char* format2 = "d:\\data\\200706_%02d_CG.txt";
FILE* fp_out;
FILE* fp_in;
for (int k = 0; k < 24; k++)
{
sprintf(file, format2, k + 1);
fp_out = fopen(file, "wt");
sprintf(file, format, k + 1, '-');
fp_in = fopen(file, "rt");
line[0] = 0;
while (!feof(fp_in))
{
fgets(line, 512, fp_in);
if (strlen(line) < 6) continue;
fputs(line, fp_out);
}
fclose(fp_in);
sprintf(file, format, k + 1, '+');
fp_in = fopen(file, "rt");
line[0] = 0;
while (!feof(fp_in))
{
fgets(line, 512, fp_in);
if (strlen(line) < 6) continue;
fputs(line, fp_out);
}
fclose(fp_in);
fclose(fp_out);
}
}把正的数据和负的数据合并一起时,为什么正的和负的数据结尾都多出行来一行,是feof()和fgets()出问题了吗?怎么解决啊!