Datasheet

The C and C++ Libraries
ARM DUI 0067D Copyright © 1999-2001 ARM Limited. All rights reserved. 4-77
{
/* Your implementation of ferror */
return EOF;
}
void test(void)
{
printf("Hello world\n"); /* This works ... */
}
By default,
fread()
and
fwrite()
call fast block input/output functions that are part of
the ARM stream implementation. If you define your own
__FILE
structure instead of
using the ARM stream implementation,
fread()
and
fwrite()
will call
fgetc()
instead
of calling the block input/output functions. See also the implementation in
\Examples\Embedded\embed\retarget.c
.
fread(), fgets(), and gets()
The functions
fread()
,
fgets()
, and
gets()
are implemented as a loop over
fgetc()
and
ferror()
. Each uses the
FILE
argument opaquely.
If you provide your own implementation of
__FILE
,
__stdin
(for
gets()
),
fgetc()
, and
ferror()
, you can use these functions directly from the library.