home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / mag&info / cujmay93.zip / 1105099A < prev    next >
Text File  |  1993-03-09  |  539b  |  30 lines

  1. /* copy3.c */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. main(int argc, char *argv[])
  7. {
  8.     if (argc == 3)
  9.     {
  10.         char s[BUFSIZ];
  11.         FILE *inf, *outf;
  12.  
  13.         if ((inf = fopen(argv[1],"r")) == NULL)
  14.             return EXIT_FAILURE;
  15.  
  16.         if ((outf = fopen(argv[2],"w")) == NULL)
  17.             return EXIT_FAILURE;
  18.  
  19.         while (fgets(s,BUFSIZ,inf))
  20.             fputs(s,outf);
  21.  
  22.         fclose(inf);
  23.         fclose(outf);
  24.         return EXIT_SUCCESS;
  25.     }
  26.     else
  27.         return EXIT_FAILURE;
  28. }
  29.  
  30.