Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ strtoul(3C) — Sun WorkShop 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ctype(3V)

scanf(3V)

strtod(3)

strtoul(3C)  —  COMPATIBILITY FUNCTIONS

NAME

strtoul − convert string to integer

SYNOPSIS

#include <stdlib.h>

DESCRIPTION

strtoul() returns as an unsigned long integer the value represented by the character string pointed to by str.  The string is scanned up to the first character inconsistent with base. Leading “white-space” characters (as defined by isspace() in ctype(3V)) are ignored. 

If the value of ptr is not (char ∗∗)NULL, a pointer to the character terminating the scan is returned in the location pointed to by ptr. If no integer can be formed, that location is set to str, and zero is returned. 

If base is positive (and not greater than 36), it is used as the base for conversion.  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” hexadecimal conversion.  Otherwise, decimal conversion is used. 

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

RETURN VALUES

If strtoul() is given a base greater than 36, it returns 0 and sets errno to EINVAL. 

SEE ALSO

ctype(3V), scanf(3V), strtod(3)

NOTES

The unbundled ANSI C compiler provides ANSI versions of most of the system header files, which are used automatically at compile time. For example, the directive
#include <stdio.h> will use the file provided by this compiler, rather than /usr/include/stdio.h. 
 

Sun Release 4.1  —  Last change: 21 June 1994

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026