2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
10 #include <dos/dosextens.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
16 /*****************************************************************************
30 Read an amount of bytes from a stream.
33 buf - The buffer to read the bytes into
34 size - Size of one block to read
35 nblocks - The number of blocks to read
36 stream - Read from this stream
39 The number of blocks read. This may range from 0 when the stream
40 contains no more blocks up to nblocks. In case of an error, 0 is
54 ******************************************************************************/
57 fdesc
*fdesc
= __getfdesc(stream
->fd
);
61 stream
->flags
|= _STDIO_ERROR
;
66 cnt
= FRead ((BPTR
)fdesc
->fcb
->fh
, buf
, size
, nblocks
);
70 errno
= __arosc_ioerr2errno (IoErr ());
71 stream
->flags
|= _STDIO_ERROR
;
75 else if (cnt
== 0 || cnt
< nblocks
)
77 stream
->flags
|= _STDIO_EOF
;