some fixes to accented characters
[tangerine.git] / rom / dos / fread.c
blob6404c2381f2d383fc8fe990623ac241c937ebadd
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include "dos_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/dos.h>
15 AROS_LH4(LONG, FRead,
17 /* SYNOPSIS */
18 AROS_LHA(BPTR , fh, D1),
19 AROS_LHA(APTR , block, D2),
20 AROS_LHA(ULONG, blocklen, D3),
21 AROS_LHA(ULONG, number, D4),
23 /* LOCATION */
24 struct DosLibrary *, DOSBase, 54, Dos)
26 /* FUNCTION
27 Read a number of blocks from a file.
29 INPUTS
30 fh - Read from this file
31 block - The data is put here
32 blocklen - This is the size of a single block
33 number - The number of blocks
35 RESULT
36 The number of blocks read from the file or 0 on EOF.
37 This function may return less than the requested number of blocks
38 IoErr() gives additional information in case of an error.
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 Open(), FWrite(), FPutc(), Close()
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 ULONG read;
56 ULONG len;
57 UBYTE *ptr;
58 LONG c;
60 ptr = block;
61 len = 0;
63 SetIoErr(0);
65 for(read = 0; read < number; read++)
67 for(len = blocklen; len--; )
69 c = FGetC(fh);
71 if(c < 0)
72 goto finish;
74 *ptr ++ = c;
77 finish:
78 if(read == 0 && len == blocklen)
80 return EOF;
83 return read;
85 AROS_LIBFUNC_EXIT
86 } /* FRead */