home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pctech / 1988_02 / bench1.c < prev    next >
Text File  |  1983-08-03  |  512b  |  28 lines

  1. #include "stdio.h"
  2.  
  3. int bench1()     /* file copy */
  4.  {
  5.     FILE  *in ,
  6.           *out ;
  7.     int c ;
  8.     long n ;
  9.  
  10.     in = fopen("a:test.in","r");
  11.     out = fopen("a:test.out","w");
  12.     if( (in == NULL) || (out ==NULL) )
  13.       { printf("can't open a file");
  14.         exit(0) ;
  15.       }
  16.     n=0;
  17.     c = getc(in) ;
  18.     while( c != EOF )
  19.       { n=n+1 ;
  20.         putc(c,out);
  21.         c = getc(in) ;
  22.       } ;
  23.     printf("\n %ld characters",n);
  24.     fclose(in);
  25.     fclose(out);
  26.  }
  27.  
  28.