Example: sprintf

The following example uses sprintf to write the name of a file to a string buffer, filename. This name is made up of the word "log", an underscore, the value of i,and the file suffix.

    int index = 56;
    char filename[64], * suffix = "txt";
    sprintf(filename, "log_%d.%s", index, suffix);
    lr_output_message ("The new file name is %s", filename);
Output:
Action.c(9): The new file name is log_56.txt