Node:Registering New Conversions, Next:Conversion Specifier Options, Up:Customizing Printf
The function to register a new output conversion is
register_printf_function
, declared in printf.h
.
int register_printf_function (int spec, printf_function handler-function, printf_arginfo_function arginfo-function) | Function |
This function defines the conversion specifier character spec.
Thus, if spec is 'Y' , it defines the conversion %Y .
You can redefine the built-in conversions like %s , but flag
characters like # and type modifiers like l can never be
used as conversions; calling register_printf_function for those
characters has no effect. It is advisable not to use lowercase letters,
since the ISO C standard warns that additional lowercase letters may be
standardized in future editions of the standard.
The handler-function is the function called by The arginfo-function is the function called by
Attention: In the GNU C library versions before 2.0 the
arginfo-function function did not need to be installed unless
the user used the The return value is You can redefine the standard output conversions, but this is probably not a good idea because of the potential for confusion. Library routines written by other people could break if you do this. |