[问题点数:50分]
比如如何读取第二行Zmini. : 后面这个-60#include <stdio.h> #include <stdlib.h> #include <memory.h> int main(void) { FILE *fp = NULL; char buf[3000] = { 0 }; int count = 0; int row = 0; int ch = 0; fp = fopen("G:\\outil1.par", "r"); if (fp == NULL) { printf("Cann't open the file!\n"); exit(1); } else { //---------------------------------------------------------------------------- while (1) { printf("Input a row you want to read: \n"); scanf("%d", &row); fflush(stdin); while (!feof(fp)) { fgets(buf, 3000, fp); count++; if (row == count) { printf("%s", buf); } memset(buf, 0, sizeof(buf)); } count = 0; rewind(fp); printf("go on? [y/n]: "); scanf("%c", &ch); fflush(stdin); //---------------------------------------------------------------- if (ch == 'y' || ch == 'Y') { continue; } else { break; } } fclose(fp); } system("pause"); return 0; }