qfedu-c-level/day14/d9.c

21 lines
364 B
C
Raw Permalink Normal View History

2023-07-21 00:58:46 +08:00
#include <stdio.h>
#include <string.h>
int main()
{
FILE *f = fopen("d9.txt", "r");
int line1_n = 0;
while (fgetc(f) != '\n')
line1_n++;
fseek(f, line1_n + 1, SEEK_SET);
char line2[100];
fgets(line2, 100, f);
line2[strlen(line2) - 1] = '\0'; // 去掉换行符
printf("line2: %s", line2);
fclose(f);
return 0;
}