This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
fputc and initialisation of buffer stdout
- From: Rosière mathieu <mathieu dot rosiere at lip6 dot fr>
- To: newlib at sources dot redhat dot com
- Date: Wed, 10 May 2006 22:52:21 +0200
- Subject: fputc and initialisation of buffer stdout
Hi all,
I'm a newbies in the utilization of newlib, and i have a lot of
questions :
1) Each thread must be execute this line " _REENT_INIT_PTR(_REENT); "
to initialize the reentrant structure, right?
2) The first instruction of my thread is :
int main()
{
_REENT_INIT_PTR(_REENT);
fputc ('0' ,stdout);
fputs ("1\n",stdout);
fputc ('2' ,stdout);
fputs ("3\n",stdout);
}
But '0' is not print. A element of respons is that _REENT_INIT_PTR and
CHECK_INIT in the case of a !_REENT_SMAAL have not malloc all std
buffer.
if i add test in /newlib/libc/stdio/fputc.c
int
_DEFUN(fputc, (ch, file),
int ch _AND
FILE * file)
{
int result;
CHECK_INIT(_REENT);
_flockfile (file);
if (cantwrite(file))
result = EOF;
else
result = putc (ch, file);
_funlockfile (file);
return result;
}
The buffer is effectively create. Is an error or a false manipulation by
me?
regards,
mathieu