DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

strtoul(D3)


strtoul -- convert string to an unsigned long integer

Synopsis

   #include <sys/types.h>
   #include <sys/ddi.h>
   

unsigned long strtoul(const char *str, char **ptr, int base)

Description

strtoul( ) returns as an unsigned long integer the value represented by str.

Arguments


str
Pointer to a character string to be converted. The string is scanned up to the first character inconsistent with the base. Leading ``white-space'' characters, as defined by isspace, are ignored.

ptr
Pointer to the character terminating the scan, unless the value is char ** NULL.

base
Base for conversion; must be a value between 2 and 36. After an optional leading sign, leading zeros are ignored, and ``0x'' or ``0X'' is ignored if base is 16. If base is zero, the string itself determines the base as follows: After an optional leading sign, a leading zero indicates octal conversion, and a leading ``0x'' or ``0X'' indicates hexadecimal conversion. Otherwise, decimal conversion is used.

Return values

If successful, strtoul( ) returns the value represented by str as an unsigned long integer. If no long integer can be formed, the ptr location is set to str, and zero is returned.

If the value represented by str would cause overflow, ULONG_MAX is returned, and errno is set to ERANGE.

Usage

strtoul( ) returns as an long integer the value represented by the character string pointed to by str.

Truncation from ulong to int can take place upon assignment or by an explicit cast.

Context and synchronization

All contexts.

Hardware applicability

All

Version applicability

ddi: 8, 8mp

References

strtoul
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005