atol(), atroll()

convert string to a long or long long integer 

Function


SYNOPSIS

#include <stdlib.h>

long atol(const char *nptr);

long long atoll(const char *nptr);


DESCRIPTION

The atol() function converts a string representing an integer to a long integer. The string to be converted consists of optional leading white space, an optional sign and a series of contiguous digits.

The call atol(nptr) is equivalent to:

strtol(nptr,(char **)NULL, 10)

The atoll() function converts the initial portion of the string pointed to by nptr to long long integer representation.

The call atoll(nptr) is equivalent to:

strtoll(nptr,(char **)NULL, 10)

PARAMETERS

nptr 

Points to a string to be converted to a long.


RETURN VALUES

The atol() function returns the converted long value.

If the converted value overflows, LONG_MIN or LONG_MAX is returned (according to the sign of the value) and errno is set to ERANGE. If no character could be converted, zero is returned.


CONFORMANCE

atol() conforms to ANSI/ISO 9899:1990 'ISO C90' atoll() conforms to ANSI/ISO 9899:1999 'ISO C99'


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
atoi(), strtol(), strtoll()


PTC MKS Toolkit 10.4 Documentation Build 39.