home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c025 / 1.ddi / FCLOSE.C < prev    next >
Encoding:
Text File  |  1985-01-23  |  254 b   |  15 lines

  1. main()    /* fclose.c -- illustrates use of fclose() */
  2. {FILE *fp;
  3. char name[20], c;
  4.  
  5.     printf("Filename: ");
  6.     gets(name);
  7.     clrerr(fp);
  8.     if ((fp = fopen(name,"r")) == NULL)
  9.         exit();
  10.     while((c = getc(fp)) != EOF)
  11.         putchar(c);
  12.     fclose(fp);
  13.  
  14. }
  15.