I tried looking it up on google and wikipedia but couldn't find an answer...Does anyone know what 'sprintf' or 'printf' stands for? Is it an abbreviation for something???
Thanks
- 1Lots of their functions have weird names. You'd think they would be more organised.Ben Shelock– Ben Shelock2010-02-20 00:27:27 +00:00CommentedFeb 20, 2010 at 0:27
3 Answers3
String PRINT Format(ed).
I.e. print to string using a given format.
Comments
The various members of theprintf family, derived from C where they first appeared (though they hark back to the olden days of BCPL'swritef call along that particular lineage), include:
printf - print formatted (to standard output).fprintf - file printf (to a file handle).sprintf - string printf (to a string).snprintf - sprintf with added overflow protection.
In addition, there are variants of those starting withv (as invsnprintf) which can take variable arguments likeprintf itself.
By that I mean that they pass around avarargs argument rather than a series of arguments, allowing you to write your ownprintf-like function. I've used this before when developing logging libraries in the past.
Comments
sprintf originates from C. Refer to e.g.
http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/
where it says:
Writes into the array pointed by str a C string ...
thus:s(tring)printf(ormatted)
1 Comment
Explore related questions
See similar questions with these tags.
