1: /*	@(#)rdwr.c	2.1	SCCS id keyword	*/
   2: #include    <stdio.h>
   3: 
   4: fread(ptr, size, count, iop)
   5: unsigned size, count;
   6: register char *ptr;
   7: register FILE *iop;
   8: {
   9:     register c;
  10:     unsigned ndone, s;
  11: 
  12:     ndone = 0;
  13:     if (size)
  14:     for (; ndone<count; ndone++) {
  15:         s = size;
  16:         do {
  17:             if ((c = getc(iop)) >= 0)
  18:                 *ptr++ = c;
  19:             else
  20:                 return(ndone);
  21:         } while (--s);
  22:     }
  23:     return(ndone);
  24: }
  25: 
  26: fwrite(ptr, size, count, iop)
  27: unsigned size, count;
  28: register char *ptr;
  29: register FILE *iop;
  30: {
  31:     register unsigned s;
  32:     unsigned ndone;
  33: 
  34:     ndone = 0;
  35:     if (size)
  36:     for (; ndone<count; ndone++) {
  37:         s = size;
  38:         do {
  39:             putc(*ptr++, iop);
  40:         } while (--s);
  41:         if (ferror(iop))
  42:             break;
  43:     }
  44:     return(ndone);
  45: }

Defined functions

fread defined in line 4; used 151 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 896
Valid CSS Valid XHTML 1.0 Strict