itoa

Data Type Conversion Functions

Converts an integer to a string. Windows only.

int itoa( int value, char *str, int radix);

string The string to convert.

itoa converts the digits of value to a string str using radix as the number base. The conventional radix is 10.

Return Values

This function returns a positive number or zero on failure.

Example

The following example writes the name of a file to the string buffer filename. The name is made up of the word "log", an underscore, and the ascii value of i which in this case is 56.

    int i = 56;
    char filename[64], file_index[32];
    if (!itoa(i, file_index, 10))
        lr_output_message ("Cannot convert i to ascii char"); 
     else {
        sprintf (filename, "log_%s.txt", file_index);
        lr_output_message ("New file name %s", filename);
     }
Example: Output:
Action.c(9): New file name log_56.txt