| www.delorie.com/gnu/docs/glibc/libc_202.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
printf
The GNU C library lets you define your own custom conversion specifiers
for printf template strings, to teach printf clever ways
to print the important data structures of your program.
The way you do this is by registering the conversion with the function
register_printf_function; see 12.13.1 Registering New Conversions.
One of the arguments you pass to this function is a pointer to a handler
function that produces the actual output; see 12.13.3 Defining the Output Handler, for information on how to write this function.
You can also install a function that just returns information about the number and type of arguments expected by the conversion specifier. See section 12.12.10 Parsing a Template String, for information about this.
The facilities of this section are declared in the header file `printf.h'.
12.13.1 Registering New Conversions Using register_printf_functionto register a new output conversion.12.13.2 Conversion Specifier Options The handler must be able to get the options specified in the template when it is called. 12.13.3 Defining the Output Handler Defining the handler and arginfo functions that are passed as arguments to register_printf_function.12.13.4 printfExtension ExampleHow to define a printfhandler function.12.13.5 Predefined printfHandlersPredefined printfhandlers.
Portability Note: The ability to extend the syntax of
printf template strings is a GNU extension. ISO standard C has
nothing similar.
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |