ack/lang/cem/libcc/stdio/fread.c

27 lines
363 B
C
Raw Permalink Normal View History

1994-06-24 14:02:31 +00:00
/* $Id$ */
1987-01-27 15:57:55 +00:00
#include <stdio.h>
fread(ptr, size, count, file)
register char *ptr;
unsigned size, count;
register FILE *file;
{
int c;
unsigned ndone = 0, s;
ndone = 0;
if (size)
while ( ndone < count ) {
s = size;
do {
if ((c = getc(file)) != EOF)
*ptr++ = c;
else
return(ndone);
} while (--s);
ndone++;
}
return(ndone);
}