home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / lib / dlibssrc / fread.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-10-05  |  512 b   |  22 lines

  1. #include <osbind.h>
  2. #include <stdio.h>
  3.  
  4. int fread(data, size, count, fp)
  5. register char *data;
  6. int size;
  7. int count;
  8. register FILE *fp;
  9. /*
  10.  *    Read <count> items of <size> characters each from stream <fp>.
  11.  *    Data is stored in the buffer pointed to by <data>.  The number of
  12.  *    full items actually read is returned, or a negative error code.
  13.  */
  14. {
  15.     register long n, lsiz;
  16.  
  17.     lsiz = ((long) size);
  18.     n = ((long) count) * lsiz;
  19.     n = Fread(fileno(fp), n, data);
  20.     return((n > 0) ? (n / lsiz) : n);
  21. }
  22.