atol

Data Type Conversion Functions

Converts a string to a long integer value.

long atol( const char *string);

string The string to convert.

atol reads the initial portion of the string only, by stopping at the first non-numerical character.

Return Values

The converted long integer value of the input string. On overflow the result is undefined. If an error occurs, returns 0.

Example

The following example converts the initial portion of the string, s, to a long value.

    long i;
    char * s = "2147483647 dollars";
    i = atol(s);
    lr_output_message ("Price $%ld", i);
Example: Output:
vuser_init.c(8): Price $2147483647