home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 163_01 / fread.c < prev    next >
Text File  |  1988-01-31  |  640b  |  19 lines

  1. /*
  2. ** binary read from a stream file
  3. ** note that ioctl should be used to reset CRMOD before calling this function
  4. */
  5. #define FILE int
  6. #define EOF (-1)
  7. extern int fgetc();
  8.  
  9. fread(ptr, size, nitems, stream) char *ptr; int size, nitems; FILE *stream; {
  10.   int icount, bcount;
  11.   icount = nitems;
  12.   while(icount--) {
  13.     bcount = size;
  14.     while(bcount--)
  15.       if((*ptr++ = fgetc(stream)) == EOF) return 0;
  16.     }
  17.   return nitems;
  18.   }
  19.