StrToInt

int StrToInt (const char string[], int *integerValue);

Purpose

Attempts to convert a nul–terminated string to an integer value.

If the bytes in the nul–terminated string contain a valid ASCII decimal representation of an integer value, and there are no extraneous non–white–space characters in the string, this function returns 1. Otherwise, this function returns 0.

This function is similar to the C library strtol function except in how extraneous characters are treated.

Parameters

Input
Name Type Description
string const char [] A nul–terminated string.
Output
Name Type Description
integerValue integer * The integer value represented by the characters in string.

If the characters in string are not a valid ASCII decimal representation of an integer value, or there are extraneous characters, this parameter is not modified.

Return Value

Name Type Description
success? integer If the bytes in the nul–terminated string contain a valid ASCII decimal representation of an integer value, and there are no extraneous non–white–space characters in the string, this function returns 1. Otherwise, this function returns 0.