There are so many different versions of printf
and scanf
in C that it brings out a chuckle in me. Let's start:
printf
: original implementation; usesformat
then the values as argumentsfprintf
: the same, but takes aFILE
pointer beforeformat
sprintf
: takes achar
pointer beforeformat
snprintf
: same as above, but limits size written for buffer overflow safetyvprintf
: likeprintf
but takes ava_list
of value argumentsvfprintf
: theva_list
equivalent offprintf
vsprintf
: theva_list
equivalent ofsprintf
vsnprintf
: theva_list
equivalent ofsnprintf
asprintf
: takes achar **
beforeformat
and allocates memory on the pointervasprintf
: the same as above, but usesva_list
scanf
: readsformat
into arguments after it fromstdin
fscanf
: takes aFILE
pointer beforeformat
, reading from it insteadsscanf
: takes achar
pointer beforeformat
, reading from it insteadvscanf
: theva_list
function analogical toscanf
vfscanf
: theva_list
function analogical tofscanf
vsscanf
: theva_list
function analogical tosscanf
Thanks to dreamlax, the ones that work with wchar_t
:
wprintf
: original implementation usingwchar_t
everywhere thatchar *
wasfwprintf
: writes to aFILE
pointer beforeformat
, usingwchar_t
swprintf
: writes to achar
pointer beforeformat
, usingwchar_t
vwprintf
: writes tostdin
, taking ava_list
instead of normal argumentsvfwprintf
: writes to aFILE
pointer, taking ava_list
instead of normal argumentsvswprintf
: writes to achar
pointer, taking ava_list
instead of normal arguments
Are there any more?