2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
12 /*****************************************************************************
23 FILE * restrict stream
)
26 Read an amount of bytes from a stream.
29 buf - The buffer to read the bytes into
30 size - Size of one block to read
31 nblocks - The number of blocks to read
32 stream - Read from this stream
35 The number of blocks read. This may range from 0 when the stream
36 contains no more blocks up to nblocks. In case of an error, 0 is
50 ******************************************************************************/
54 if (size
== 0 || nblocks
== 0)
57 if (!(stream
->flags
& __STDCIO_STDIO_READ
))
59 SetIoErr(ERROR_READ_PROTECTED
);
61 stream
->flags
|= __STDCIO_STDIO_ERROR
;
65 cnt
= FRead (stream
->fh
, buf
, size
, nblocks
);
69 errno
= __stdc_ioerr2errno (IoErr ());
70 stream
->flags
|= __STDCIO_STDIO_ERROR
;
74 else if (cnt
< nblocks
)
76 stream
->flags
|= __STDCIO_STDIO_EOF
;