可惜MS-DOS不是中国人写的,不支持中文。 /* Note:Your choice is C IDE */ #include "stdio.h" main(int argc, char *argv[]) { FILE *fp; char ch; int num=0,max; int line=0; if((fp=fopen(argv[1],"rt"))==NULL) { printf("/nCannot open file strike any key exit!"); getch(); exit(1); } while(ch!=EOF) { if(wherex()==1) {num++;printf("%d: ",num);} putchar(ch); ch=fgetc(fp); } max=num; num=0; fclose(fp); while(1) { num=0; fp=fopen(argv[1],"rt"); ch=fgetc(fp); while(ch!=EOF) { if(wherex()==1) {num++;printf("%d: ",num);} if(num==line+24) break; putchar(ch); ch=fgetc(fp); } printf("Which line do you want going to?(Most %d)",max); scanf("%d",&line); if(line<=0) exit(1); } }