low_str_sprintf
Write formatted data to a string.
l_int low_str_sprintf (
l_text buffer,
cl_text format,
[, argument] ...
);
Return Value
the number of bytes stored in buffer, not counting the terminating null character.
Parameters
buffer
Storage location for output
format
Format-control string
argument
Optional arguments
Remarks
The low_str_sprintf function formats and stores a series of characters and values in buffer. Each argument (if any) is converted and output according to the corresponding format specification in format.
The format consists of ordinary characters and has the same form and function as the format argument for low_str_printf. A null character is appended after the last character written.
If copying occurs between strings that overlap, the behavior is undefined.
Example
/* LOW_STR_SPRINTF.C: This program uses sprintf to format various
* data and place them in the string named buffer.
*/
#include <matrixos.h>
void main( void ) {
l_char buffer[256];
l_text hello = "Hello";
l_int i = 25, j = 0;
l_double db = 1.23456789;
/* Format and print various data: */
j = sprintf( buffer, "Integer: %d\nDouble: %f\nChar: %c\nString: %s", i, db, 'a', hello);
DEBUG_printf(j);
}
Output in debug.deb
Output:
Integer: 25
Double: 1.23456789
Char: a
String: Hello