home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol144 / io.c < prev    next >
Encoding:
C/C++ Source or Header  |  1984-04-29  |  510 b   |  40 lines

  1. #include <bdscio.h>
  2. #include "sqcom.h"
  3. #include "sq.h"
  4.  
  5. /* Get next byte from file and update checksum */
  6.  
  7. int
  8. getc_crc(ib)
  9. struct _buf *ib;
  10. {
  11.     int c;
  12.  
  13.     c = getc(ib);
  14.     if(c != EOF)
  15.         crc += c;    /* checksum */
  16.     return c;
  17. }
  18.  
  19. /* Output functions with error reporting */
  20.  
  21. putce(c, iob)
  22. int c;
  23. struct _buf *iob;
  24. {
  25.     if(putc(c, iob) == ERROR) {
  26.         printf("Write error in putc()\n");
  27.         exit(1);
  28.     }
  29. }
  30.  
  31. putwe(w, iob)
  32. int w;
  33. struct _buf *iob;
  34. {
  35.     if(putw(w, iob) != w) {
  36.         printf("Write error in putw()\n");
  37.         exit(1);
  38.     }
  39. }
  40.