Last change
on this file since 6099cac was 8973acd, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
No more warnings in libcio.
|
-
Property mode
set to
100644
|
File size:
882 bytes
|
Rev | Line | |
---|
[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | fread.c -- read a stream file
|
---|
| 4 | Version 3 -- 1987-06-29 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[f40a309] | 9 |
|
---|
| 10 | /*
|
---|
| 11 | =============================================================================
|
---|
| 12 | fread(buffer, size, number, stream) -- read 'number' items of size
|
---|
| 13 | 'size' bytes from file 'stream' into 'buffer'.
|
---|
| 14 | =============================================================================
|
---|
| 15 | */
|
---|
| 16 |
|
---|
[8973acd] | 17 | int16_t fread(void *buffer, int16_t size, int16_t number, FILE *stream)
|
---|
[f40a309] | 18 | {
|
---|
[8973acd] | 19 | uint8_t *buffer8;
|
---|
[7258c6a] | 20 | int16_t total;
|
---|
| 21 | register int16_t c,i;
|
---|
[f40a309] | 22 |
|
---|
[8973acd] | 23 | buffer8 = buffer;
|
---|
| 24 |
|
---|
[f40a309] | 25 | for (total = 0; total < number; ++total) {
|
---|
| 26 |
|
---|
| 27 | for (i = size; i; --i) {
|
---|
| 28 |
|
---|
| 29 | if ((c = getc(stream)) EQ EOF)
|
---|
| 30 | return(total);
|
---|
| 31 |
|
---|
[8973acd] | 32 | *buffer8++ = (uint8_t)c;
|
---|
[f40a309] | 33 | }
|
---|
| 34 | }
|
---|
| 35 | return(total);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
[6262b5c] | 38 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.