Older Newer
Sun, 23 Apr 2017 05:28:01 . . . . SyneRyder [Add see-also link to formatString]
Thu, 03 Dec 2015 18:47:39 . . . . SyneRyder [Basic entry for sprintf (does not include specifiers or example yet)]


Changes by last author:

Added:
= sprintf =

== Syntax ==

:int sprintf (char * str, const char * format, ... )

== Arguments ==

:str

::Pointer to a string buffer to store the string

:format

::Specifies the format of the resulting string, including types of the variables to be included in the string.

== Return ==

:The number of bytes printed if successful, otherwise a negative number if unsuccessful.

== Description ==

:sprintf "prints" a formatted string, except instead of printing it to a terminal console, it stores the result in a string variable.

== Also see ==

:snprintf, formatString

== Comments ==

:Wherever possible, you should use snprintf instead. sprintf can have potential buffer overruns (crashes) depending how it is used - snprinf prevents the overruns.