NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
long strtoul ( const string &  str,
string &  endptr,
int  base = 10 
)
inline

Convert string to unsigned long integer.

Parses the C string str interpreting its content as an unsigned integral number of the specified base, which is returned as an unsigned long int value.

The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes as many characters as possible that are valid following a syntax that depends on the base parameter, and interprets them as a numerical value. A string containing the rest of the characters following the integer representation in str is stored in endptr.

If the first sequence of non-whitespace characters in str does not form a valid integral number, or if no such sequence exists because either str is empty or contains only whitespace characters, no conversion is performed.

Parameters
strString containing the representation of an unsigned integral number.
endptrReference to a string, whose value is set by the function to the remaining characters in str after the numerical value.
baseOptional and ignored if specified.
Returns
On success, the function returns the converted integral number as an unsigned long int value. If no valid conversion could be performed a zero value is returned.
Warning
Only base = 10 is currently supported.
Examples:
ex_strtoul.nxc.