sprintf

Example: sprintfInput-Output Functions

Writes formatted output to a string.

int sprintf( char *string_buffer, const char *format_string[, args]);

string The target string buffer to which you write the data.
format_string One or more formatting characters.
args One or more optional print arguments.

For sprintf details, refer to your C language documentation.

The target string_buffer must be large enough to contain the result of the format_string and args. Buffer overflow if the result string is larger than the buffer may cause erratic behavior in the script.

Return Values

If successful, the function returns the total number of characters printed. Upon error, it returns a negative number.