Strtol - Texas Instruments TI-89 Developer's Manual

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

Appendix A: System Routines — Utilities

strtol

Declaration:
long strtol (const char * str , char ** end_ptr , int base )
Category(ies):
Utilities, Strings
Description:
Converts the initial portion of the string pointed to by str into a long int, and
if end_ptr is not a null pointer, sets the character pointer pointed to by
end_ptr to the address of the first character following the set of characters
converted. The function skips leading whitespace, accepts an optional sign
character (+ or -), then scans a sequence of alphanumeric characters
matching some integer represented in a base determined from the value of
base .
If the value of base is zero, the conversion base is determined by the initial
characters in the alphanumeric sequence. If the first character is 0 and the
second character is x or X, hexadecimal conversion is performed. If the first
character is 0 and the second character is not x or X, octal conversion is
performed. Otherwise, decimal conversion is performed.
If the value of base is between 2 and 36, a sequence of letters and digits
representing an integer of the indicated base is accepted. The letters a
through z (or A through Z) represent the values 10 through 35. Only letters
and digits with values less than the value of base are converted. If the
value of base is 16 the sequence 0 followed by x or X may optionally
precede the alphanumeric sequence.
Conversion of the string continues until a character is encountered that is
not a digit in the indicated base. If end_ptr is not a null pointer, the object it
points to is assigned a pointer to this first unconverted character.
str
Inputs:
end_ptr — Points to a character pointer that will contain the address of
base
Outputs:
Returns the converted long int value. If no conversion can be performed,
zero is returned. If the conversion results in an overflow, errno is set to
ERANGE. In this case, strtol returns LONG_MAX or LONG_MIN
depending on the sign of the result. If the value of base is neither 0 nor in
the range 2 to 36, the object pointed to by end_ptr is set to str , 0 is
returned, and errno is set to EDOM.
TI-89 / TI-92 Plus Developer Guide
— String to convert.
the first character following the set of characters converted
when the function returns (or null).
— Conversion base.
(continued)
Not for Distribution
1111
Beta Version January 26, 2001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-92 plus

Table of Contents