isblank() implementation.
[minix.git] / lib / libc / stdio / fread.c
bloba02f83ad29f4ed5584d8cc73595cb7b80533fdfa
1 /*
2 * fread.c - read a number of members into an array
3 */
4 /* $Header$ */
6 #include <stdio.h>
8 size_t
9 fread(void *ptr, size_t size, size_t nmemb, register FILE *stream)
11 register char *cp = ptr;
12 register int c;
13 size_t ndone = 0;
14 register size_t s;
16 if (size)
17 while ( ndone < nmemb ) {
18 s = size;
19 do {
20 if ((c = getc(stream)) != EOF)
21 *cp++ = c;
22 else
23 return ndone;
24 } while (--s);
25 ndone++;
28 return ndone;