source: buchla-68k/orig/IOLIB/FREAD.C@ 4b63bf3

Last change on this file since 4b63bf3 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 919 bytes
Line 
1/*
2 =============================================================================
3 fread.c -- read a stream file
4 Version 3 -- 1987-06-29 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stdio.h"
9#include "stddefs.h"
10
11/*
12 =============================================================================
13 fread(buffer, size, number, stream) -- read 'number' items of size
14 'size' bytes from file 'stream' into 'buffer'.
15 =============================================================================
16*/
17
18int
19fread(buffer, size, number, stream)
20register char *buffer;
21unsigned size;
22int number;
23FILE *stream;
24{
25 int total;
26 register int c,i;
27
28 for (total = 0; total < number; ++total) {
29
30 for (i = size; i; --i) {
31
32 if ((c = getc(stream)) EQ EOF)
33 return(total);
34
35 *buffer++ = c;
36 }
37 }
38 return(total);
39}
40
Note: See TracBrowser for help on using the repository browser.