How to override standard printf defined in gcc library

Kai Ruottu kai.ruottu@wippies.com
Tue Oct 27 22:44:00 GMT 2009


RahulJain83 wrote:
> Above code works fine for following fprintf calls (that pass variable
> argument list to fprintf) -
>
> fprintf (stdout,"This is a variable argument message - %s\n", "Rahul Jain");
>
> However, for following fprintf call (that is not taking any variable
> arguments), it seems fprintf from libgcc is getting picked up as then print
> comes on the screen instead of our Graphical interface window -
>
> fprintf (stdout,"This is a variable argument message - Rahul Jain\n");
>
> I am not sure why this is happening. Is fprintf implemented as macro, such
> that it is working for case1 and not for case2. Can anybody help.
>   
Please check that those 'printf()'s haven't been changed to 'puts()'s 
!   Sometimes I found out that
GCC produces a call to 'puts()'  instead of 'printf()' with the simple 
"Hello World" program... Why
it does this kind of optimization, is unclear but when this happens, 
doing something similar with 'puts()'
could be your workaround...



More information about the Gcc-help mailing list