home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume5 / smallc / part3 / vax / B2test.c next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  655 b   |  30 lines

  1. #include <stdio.h>
  2.  
  3. main () {
  4.     FILE *infile; FILE *outfile;
  5.     int c;
  6.     puts("Starting input only");
  7.     if ((infile = fopen("b2test.dat","r")) == NULL ) {
  8.         puts("could not open input file");
  9.         exit(1);
  10.     }
  11.     while (putchar(fgetc(infile)) != EOF);
  12.     puts("end of input file");
  13.     fclose(infile);
  14.     puts("starting copy");
  15.     if ((infile = fopen("b2test.dat","r")) == NULL) {
  16.         puts("could not open input file for copy");
  17.         exit(1);
  18.     }
  19.     if ((outfile = fopen("b2test.out","w")) == NULL) {
  20.         puts("could not open output file");
  21.         exit(1);
  22.     }
  23.     while ((c = fgetc(infile)) != EOF) {
  24.         fputc(c, outfile);
  25.     }
  26.     puts("finished output file");
  27.     fclose(infile);
  28.     fclose(outfile);
  29. }
  30.