home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / communic / sercom / downl1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-09-04  |  674 b   |  51 lines

  1. #include "stdio.h";
  2.  
  3. FILE *fstart();
  4.  
  5. main(argc, argv)
  6. int argc;
  7. char *argv[];
  8. {
  9. FILE *f;
  10.  
  11.     f = fstart(argc, argv);
  12.     if (f == NULL) 
  13.         exit();
  14.  
  15.     printf("%s \n", "Waiting for input");
  16.  
  17.     downl1(f);
  18.  
  19.     fclose(f);            /* Close the File    */
  20.  
  21.     printf("%s \n", "Finished");
  22.         
  23. }
  24.  
  25. downl1(f)
  26. FILE *f;
  27. {
  28. unsigned char ch;
  29.  
  30.     for (;;) {
  31.         if (kbhit()) {
  32.             if (getch() == 27) return;    /* Hit ESC    */
  33.         }
  34.  
  35.         ch = bdos(3, 0, 0);    /* Get a character        */
  36.  
  37.         if (ch == 26)         /* ^ Z                */
  38.             return;
  39.  
  40.         fputc(ch, f);        /* record it to the file     */
  41.  
  42.         putchar(ch);        /* Display it             */
  43.     }
  44. }
  45.  
  46.  
  47.  
  48.  
  49. /* Figure 16.8: DOWNL1.C, Read a File, DOS version */
  50.  
  51.