2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
5 ANSI C function fread().
10 #include <dos/dosextens.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
17 /*****************************************************************************
31 Read an amount of bytes from a stream.
34 buf - The buffer to read the bytes into
35 size - Size of one block to read
36 nblocks - The number of blocks to read
37 stream - Read from this stream
40 The number of blocks read. This may range from 0 when the stream
41 contains no more blocks up to nblocks. In case of an error, 0 is
55 ******************************************************************************/
58 fdesc
*fdesc
= __getfdesc(stream
->fd
);
62 stream
->flags
|= _STDIO_ERROR
;
67 cnt
= FRead ((BPTR
)fdesc
->fcb
->fh
, buf
, size
, nblocks
);
71 errno
= IoErr2errno (IoErr ());
72 stream
->flags
|= _STDIO_ERROR
;
76 else if (cnt
== 0 || cnt
< nblocks
)
78 stream
->flags
|= _STDIO_EOF
;