Standard C Functions


strtoul


Syntax

#include <stdlib.h>
unsigned long strtoul(const char *string, char **endptr, int base)

Arguments

string      character string to be converted
endptr      pointer to a pointer to an unrecognizable character string
base        radix (for bases from 2 to 36); if 0 is specified as the radix, the 
            actual radix is obtained by using the first one or two characters of the 
            string 

Return Value

The converted numeric unsigned long value of the character string 

Description

Convert a specified character string to an unsigned long. Specify a character string using the following format:

[whitespace][{sign}][{0}][{x | X}][digits]
<whitespace>
white space characters, 0x09 ~ 0x0d, 0x20

<sign>
+ (note that - is considered to be an unrecognizable character)

<digits>
a string of more than one numeric characters

If 0 is specified as the radix base, the radix is interpreted as follows:

Conversion is terminated when an unrecognizable character appears as a part of the number.

If endptr is not NULL, it points to *endptr, which points to the unrecognizable character that terminated the conversion.