grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / dos / fgetc.c
blob3bca5241197c31b2bbf1b4fba74cb7370e0a9dab
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <exec/memory.h>
11 #include <proto/exec.h>
13 #include <dos/stdio.h>
14 #include <dos/dosextens.h>
16 #include "dos_intern.h"
19 /*****************************************************************************
21 NAME */
22 #include <proto/dos.h>
24 AROS_LH1(LONG, FGetC,
26 /* SYNOPSIS */
27 AROS_LHA(BPTR, file, D1),
29 /* LOCATION */
30 struct DosLibrary *, DOSBase, 51, Dos)
32 /* FUNCTION
33 Get a character from a buffered file. Buffered I/O is more efficient
34 for small amounts of data but less for big chunks. You have to
35 use Flush() between buffered and non-buffered I/O or you'll
36 clutter your I/O stream.
38 INPUTS
39 file - filehandle
41 RESULT
42 The character read or EOF if the file ended or an error happened.
43 IoErr() gives additional information in that case.
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
52 IoErr(), Flush()
54 INTERNALS
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 UBYTE c;
61 LONG res;
63 res = vbuf_fetch(file, &c, 1, DOSBase);
65 if (res < 0)
66 return EOF;
67 else
68 return c;
70 AROS_LIBFUNC_EXIT
71 } /* FGetC */