1
0

c10-3-2.c 343 B

1234567891011121314151617
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main()
  4. { FILE *fp;
  5. char str[3][10];
  6. int i=0;
  7. if((fp=fopen("D:\\CC\\string.dat","r"))==NULL) // 注意文件名必须与前相同
  8. {printf("can't open file!\n");
  9. exit(0);
  10. }
  11. while(fgets(str[i],10,fp)!=NULL)
  12. {printf("%s",str[i]);
  13. i++;
  14. }
  15. fclose(fp);
  16. return 0;
  17. }