Blame man-pages-posix-2013-a/man3p/wcstol.3p

Packit 7cfc04
'\" et
Packit 7cfc04
.TH WCSTOL "3P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
Packit 7cfc04
.SH PROLOG
Packit 7cfc04
This manual page is part of the POSIX Programmer's Manual.
Packit 7cfc04
The Linux implementation of this interface may differ (consult
Packit 7cfc04
the corresponding Linux manual page for details of Linux behavior),
Packit 7cfc04
or the interface may not be implemented on Linux.
Packit 7cfc04
Packit 7cfc04
.SH NAME
Packit 7cfc04
wcstol,
Packit 7cfc04
wcstoll
Packit 7cfc04
\(em convert a wide-character string to a long integer
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.LP
Packit 7cfc04
.nf
Packit 7cfc04
#include <wchar.h>
Packit 7cfc04
.P
Packit 7cfc04
long wcstol(const wchar_t *restrict \fInptr\fP, wchar_t **restrict \fIendptr\fP,
Packit 7cfc04
    int \fIbase\fP);
Packit 7cfc04
long long wcstoll(const wchar_t *restrict \fInptr\fP,
Packit 7cfc04
    wchar_t **restrict \fIendptr\fP, int \fIbase\fP);
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The functionality described on this reference page is aligned with the
Packit 7cfc04
ISO\ C standard. Any conflict between the requirements described here and the
Packit 7cfc04
ISO\ C standard is unintentional. This volume of POSIX.1\(hy2008 defers to the ISO\ C standard.
Packit 7cfc04
.P
Packit 7cfc04
These functions shall convert the initial portion of the wide-character
Packit 7cfc04
string pointed to by
Packit 7cfc04
.IR nptr
Packit 7cfc04
to
Packit 7cfc04
.BR long
Packit 7cfc04
and
Packit 7cfc04
.BR "long long" ,
Packit 7cfc04
respectively. First, they shall decompose the input string into three
Packit 7cfc04
parts:
Packit 7cfc04
.IP " 1." 4
Packit 7cfc04
An initial, possibly empty, sequence of white-space wide-character
Packit 7cfc04
codes (as specified by
Packit 7cfc04
\fIiswspace\fR())
Packit 7cfc04
.IP " 2." 4
Packit 7cfc04
A subject sequence interpreted as an integer represented in some radix
Packit 7cfc04
determined by the value of
Packit 7cfc04
.IR base
Packit 7cfc04
.IP " 3." 4
Packit 7cfc04
A final wide-character string of one or more unrecognized
Packit 7cfc04
wide-character codes, including the terminating null wide-character
Packit 7cfc04
code of the input wide-character string
Packit 7cfc04
.P
Packit 7cfc04
Then they shall attempt to convert the subject sequence to an
Packit 7cfc04
integer, and return the result.
Packit 7cfc04
.P
Packit 7cfc04
If
Packit 7cfc04
.IR base
Packit 7cfc04
is 0, the expected form of the subject sequence is that of a decimal
Packit 7cfc04
constant, octal constant, or hexadecimal constant, any of which may be
Packit 7cfc04
preceded by a
Packit 7cfc04
.BR '+' 
Packit 7cfc04
or
Packit 7cfc04
.BR '\(mi' 
Packit 7cfc04
sign. A decimal constant begins with a non-zero digit, and consists of
Packit 7cfc04
a sequence of decimal digits. An octal constant consists of the prefix
Packit 7cfc04
.BR '0' 
Packit 7cfc04
optionally followed by a sequence of the digits
Packit 7cfc04
.BR '0' 
Packit 7cfc04
to
Packit 7cfc04
.BR '7' 
Packit 7cfc04
only. A hexadecimal constant consists of the prefix 0x or 0X followed
Packit 7cfc04
by a sequence of the decimal digits and letters
Packit 7cfc04
.BR 'a' 
Packit 7cfc04
(or
Packit 7cfc04
.BR 'A' )
Packit 7cfc04
to
Packit 7cfc04
.BR 'f' 
Packit 7cfc04
(or
Packit 7cfc04
.BR 'F' )
Packit 7cfc04
with values 10 to 15 respectively.
Packit 7cfc04
.P
Packit 7cfc04
If the value of
Packit 7cfc04
.IR base
Packit 7cfc04
is between 2 and 36, the expected form of the subject sequence is a
Packit 7cfc04
sequence of letters and digits representing an integer with the radix
Packit 7cfc04
specified by
Packit 7cfc04
.IR base ,
Packit 7cfc04
optionally preceded by a
Packit 7cfc04
.BR '+' 
Packit 7cfc04
or
Packit 7cfc04
.BR '\(mi' 
Packit 7cfc04
sign, but not including an integer suffix. The letters from
Packit 7cfc04
.BR 'a' 
Packit 7cfc04
(or
Packit 7cfc04
.BR 'A' )
Packit 7cfc04
to
Packit 7cfc04
.BR 'z' 
Packit 7cfc04
(or
Packit 7cfc04
.BR 'Z' )
Packit 7cfc04
inclusive are ascribed the values 10 to 35; only letters whose ascribed
Packit 7cfc04
values are less than that of
Packit 7cfc04
.IR base
Packit 7cfc04
shall be permitted. If the value of
Packit 7cfc04
.IR base
Packit 7cfc04
is 16, the wide-character code representations of 0x or 0X may
Packit 7cfc04
optionally precede the sequence of letters and digits, following the
Packit 7cfc04
sign if present.
Packit 7cfc04
.P
Packit 7cfc04
The subject sequence is defined as the longest initial subsequence of
Packit 7cfc04
the input wide-character string, starting with the first
Packit 7cfc04
non-white-space wide-character code that is of the expected form. The
Packit 7cfc04
subject sequence contains no wide-character codes if the input
Packit 7cfc04
wide-character string is empty or consists entirely of white-space
Packit 7cfc04
wide-character code, or if the first non-white-space wide-character
Packit 7cfc04
code is other than a sign or a permissible letter or digit.
Packit 7cfc04
.P
Packit 7cfc04
If the subject sequence has the expected form and
Packit 7cfc04
.IR base
Packit 7cfc04
is 0, the sequence of wide-character codes starting with the first
Packit 7cfc04
digit shall be interpreted as an integer constant. If the subject
Packit 7cfc04
sequence has the expected form and the value of
Packit 7cfc04
.IR base
Packit 7cfc04
is between 2 and 36, it shall be used as the base for conversion,
Packit 7cfc04
ascribing to each letter its value as given above. If the subject
Packit 7cfc04
sequence begins with a minus-sign, the value resulting from the
Packit 7cfc04
conversion shall be negated. A pointer to the final wide-character
Packit 7cfc04
string shall be stored in the object pointed to by
Packit 7cfc04
.IR endptr ,
Packit 7cfc04
provided that
Packit 7cfc04
.IR endptr
Packit 7cfc04
is not a null pointer.
Packit 7cfc04
.P
Packit 7cfc04
In other than the C
Packit 7cfc04
or POSIX
Packit 7cfc04
locales, other implementation-defined subject sequences may be
Packit 7cfc04
accepted.
Packit 7cfc04
.P
Packit 7cfc04
If the subject sequence is empty or does not have the expected form, no
Packit 7cfc04
conversion shall be performed; the value of
Packit 7cfc04
.IR nptr
Packit 7cfc04
shall be stored in the object pointed to by
Packit 7cfc04
.IR endptr ,
Packit 7cfc04
provided that
Packit 7cfc04
.IR endptr
Packit 7cfc04
is not a null pointer.
Packit 7cfc04
.P
Packit 7cfc04
These functions shall not change the setting of
Packit 7cfc04
.IR errno
Packit 7cfc04
if successful.
Packit 7cfc04
.P
Packit 7cfc04
Since 0,
Packit 7cfc04
{LONG_MIN}
Packit 7cfc04
or
Packit 7cfc04
{LLONG_MIN}
Packit 7cfc04
and
Packit 7cfc04
{LONG_MAX}
Packit 7cfc04
or
Packit 7cfc04
{LLONG_MAX}
Packit 7cfc04
are returned on error and are also valid returns on success, an
Packit 7cfc04
application wishing to check for error situations should set
Packit 7cfc04
.IR errno
Packit 7cfc04
to 0, then call
Packit 7cfc04
\fIwcstol\fR()
Packit 7cfc04
or
Packit 7cfc04
\fIwcstoll\fR(),
Packit 7cfc04
then check
Packit 7cfc04
.IR errno .
Packit 7cfc04
.SH "RETURN VALUE"
Packit 7cfc04
Upon successful completion, these functions shall return the converted
Packit 7cfc04
value, if any. If no conversion could be performed, 0 shall be returned
Packit 7cfc04
and
Packit 7cfc04
.IR errno
Packit 7cfc04
may be set to indicate the error.
Packit 7cfc04
If the correct value is outside the range of representable values,
Packit 7cfc04
{LONG_MIN},
Packit 7cfc04
{LONG_MAX},
Packit 7cfc04
{LLONG_MIN},
Packit 7cfc04
or
Packit 7cfc04
{LLONG_MAX}
Packit 7cfc04
shall be returned (according to the sign of the value), and
Packit 7cfc04
.IR errno
Packit 7cfc04
set to
Packit 7cfc04
.BR [ERANGE] .
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
These functions shall fail if:
Packit 7cfc04
.TP
Packit 7cfc04
.BR EINVAL
Packit 7cfc04
The value of
Packit 7cfc04
.IR base
Packit 7cfc04
is not supported.
Packit 7cfc04
.TP
Packit 7cfc04
.BR ERANGE
Packit 7cfc04
The value to be returned is not representable.
Packit 7cfc04
.P
Packit 7cfc04
These functions may fail if:
Packit 7cfc04
.TP
Packit 7cfc04
.BR EINVAL
Packit 7cfc04
No conversion could be performed.
Packit 7cfc04
.LP
Packit 7cfc04
.IR "The following sections are informative."
Packit 7cfc04
.SH EXAMPLES
Packit 7cfc04
None.
Packit 7cfc04
.SH "APPLICATION USAGE"
Packit 7cfc04
None.
Packit 7cfc04
.SH RATIONALE
Packit 7cfc04
None.
Packit 7cfc04
.SH "FUTURE DIRECTIONS"
Packit 7cfc04
None.
Packit 7cfc04
.SH "SEE ALSO"
Packit 7cfc04
.IR "\fIfscanf\fR\^(\|)",
Packit 7cfc04
.IR "\fIiswalpha\fR\^(\|)",
Packit 7cfc04
.IR "\fIwcstod\fR\^(\|)"
Packit 7cfc04
.P
Packit 7cfc04
The Base Definitions volume of POSIX.1\(hy2008,
Packit 7cfc04
.IR "\fB<wchar.h>\fP"
Packit 7cfc04
.SH COPYRIGHT
Packit 7cfc04
Portions of this text are reprinted and reproduced in electronic form
Packit 7cfc04
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
Packit 7cfc04
-- Portable Operating System Interface (POSIX), The Open Group Base
Packit 7cfc04
Specifications Issue 7, Copyright (C) 2013 by the Institute of
Packit 7cfc04
Electrical and Electronics Engineers, Inc and The Open Group.
Packit 7cfc04
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
Packit 7cfc04
event of any discrepancy between this version and the original IEEE and
Packit 7cfc04
The Open Group Standard, the original IEEE and The Open Group Standard
Packit 7cfc04
is the referee document. The original Standard can be obtained online at
Packit 7cfc04
http://www.unix.org/online.html .
Packit 7cfc04
Packit 7cfc04
Any typographical or formatting errors that appear
Packit 7cfc04
in this page are most likely
Packit 7cfc04
to have been introduced during the conversion of the source files to
Packit 7cfc04
man page format. To report such errors, see
Packit 7cfc04
https://www.kernel.org/doc/man-pages/reporting_bugs.html .