source: buchla-68k/libcio/fread.c@ f40a309

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

Unix line breaks.

  • Property mode set to 100644
File size: 879 bytes
RevLine 
[f40a309]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.