wcstol

Converts a wide-character string in a specified base to a long integer value.

Format

#include  <wchar.h>

long int wcstol  (const wchar_t *nptr, wchar_t
                 **endptr, int base);
Function Variants This function also has variants named _wcstol32 and _wcstol64 for use with 32-bit and 64-bit pointer sizes, respectively. See Section 1.8 for more information on using pointer-size-specific functions.

Arguments

nptr
A pointer to the wide-character string to be converted to a long integer.
endptr
The address of an object where the function can store a pointer to the first unrecognized character encountered in the conversion process (the character that follows the last character processed in the string being converted). If endptr is a NULL pointer, the address of the first unrecognized character is not retained.
base
The value, 2 through 36, to use as the base for the conversion.

If base is 16, leading zeros after the optional sign are ignored, and 0x or 0X is ignored.

If base is 0, the sequence of characters is interpreted by the same rules used to interpret an integer constant-After the optional sign:

Description

This function recognizes strings in various formats, depending on the value of the base. This function ignores any leading white- space characters (as defined by the iswspace function) in the given string. It recognizes an optional plus or minus sign, then a sequence of digits or letters that can represent an integer constant according to the value of the base. The first unrecognized character ends the conversion.

Return Values
The converted value. 
Indicates that the string starts with an unrecognized wide character or that the value for base is invalid. If the string starts with an unrecognized wide character, *endptr is set to nptr. The function sets errno to EINVAL. 
LONG_MAX or LONG_MIN  Indicates that the converted value would cause a positive or negative overflow, respectively. The function sets errno to ERANGE. 


Previous Page | Next Page | Table of Contents | Index