strtoul, wcstoul
Go Up to stdlib.h Index
Header File
stdlib.h
Category
Conversion Routines, Math Routines
Prototype
unsigned long strtoul(const char *s, char **endptr, int radix);
unsigned long wcstoul(const wchar_t *s, wchar_t **endptr, int radix);
Description
Converts a string to an unsigned long in the given radix.
strtoul operates the same as strtol, except that it converts a string str to an unsigned long value (where strtol converts to a long). Refer to the entry for strtol for more information.
Return Value
strtoul returns the converted value, an unsigned long, or 0 on error.
Example
#include <stdlib.h> #include <stdio.h> int main(void) { char *string = "87654321", *endptr; unsigned long lnumber; lnumber = strtoul(string, &endptr, 10); printf("string = %s long = %lu\n", string, lnumber); return 0; }
Portability
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
strtoul |
+ |
+ |
+ |
+ |
wcstoul |
+ |
+ |
+ |