home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <time.h>
- #include <stdlib.h>
- #include <string.h>
- #include <libp.h>
-
- int fread(unsigned char *buf, size_t size, size_t count, FILE *stream)
- {
- int rv;
- int len = count * size,i;
- if (stream->token != FILTOK)
- return 0;
- if (!(stream->flags & _F_READ)) {
- stream->flags |= _F_ERR;
- return 0;
- }
- for (i=0; i < len; i++) {
- rv = _basegetc(stream);
- if (rv == EOF)
- return i / size;
- *buf++ = (char) rv;
- }
- return count;
- }