Share this page

# 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);

    Example: Output:
    Action.c(9): The new file name is log_56.txt

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: