str_printf(STRING* string, STRING* format, ....)

Copies formatted strings and variables into a target string, using a C style format string. Unlike most other functions, this one accepts a variable number of char*, int, or double arguments (no var or float). Make sure in its argument list to typecast a var to (long) or (double), and convert STRING* to char* with the _chr function. The format string must contain specifications that determine the output format for the arguments that follow. See a C language documentation or Digits for C-style format strings. A7.82 LC 

Parameters:

string - Target string pointer, or NULL for returning a temporary string pointer.
format
- Format string, STRING* or char*.

Returns:

string

Speed:

Medium

Example:

function display_some_statistics() 
{
  while(1) {
draw_text(str_printf(NULL,
"Frames per second: %d\nEntities total: %d\nEntities visible: %d",
(long)(16/time_frame),(long)num_entities,(long)num_visents),
10,10,COLOR_RED);
wait(1); }
}

See also:

diag, Digits, printf, str_cpy, str_cat_num

► latest version online