 |
vcbprintf |
Function (ROM Call*) |
Virtual callback printing function.
vcbprintf is an auxiliary function which is the heart of all v...printf functions.
arglist is a pointer to the list of arguments (see stdarg.h
for more info about argument lists), and format is the format string, as
usually. vcbprintf applies to each argument a format specifier contained in the format string.
After this, the formatted data is sent character by character to the callback function
callback passing the actual characters as the parameter c to it. Also, the parameter
param of vcbprint is passed as the second parameter to the callback function. This
allows for much more flexibility, because a callback function usually needs more info than a simple
character to be processed. The callback function for example can push characters to a stream, so
in this case param would probably be a pointer to the stream structure. More precisely,
vfprintf (stream, format, arglist);
is exactly the same as
vcbprintf ((vcbprintf_callback_t)fputc, (void**)stream, format, arglist);
See also TE_pasteText for an ununsual but powerful
example of usage of vcbprintf.
param is declared as a "double pointer" because it is often used as a pointer to a
pointer variable (in vsprintf for example), so the callback function
is able to change the content of the actual pointer variable (see strputchar).
Used by: cbprintf, fprintf, printf, vfprintf, vprintf, vsprintf