Share this page

# atoi

Data Type Conversion Functions

Converts a string to an integer value.

    int atoi( const char *string);

string | The string to convert.

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

## Return Values

The converted 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 an integer.

Copy code

        int i;
        char * s = "7 dollars";
        i = atoi(s);
        lr_output_message ("Price $%d", i);

    Example: Output:
    vuser_init.c(7): Price $7

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