2 Copyright © 1995-2013, 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
|= __POSIXC_STDIO_ERROR
;
68 cnt
= FRead (fdesc
->fcb
->handle
, buf
, size
, nblocks
);
72 errno
= __stdc_ioerr2errno (IoErr ());
73 stream
->flags
|= __POSIXC_STDIO_ERROR
;
77 else if (cnt
== 0 || cnt
< nblocks
)
79 stream
->flags
|= __POSIXC_STDIO_EOF
;