xref: /freebsd/lib/libc/stdio/wscanf.3 (revision dc36d6f9bb1753f3808552f3afd30eda9a7b206a)
11f4ff850STim J. Robbins.\" Copyright (c) 1990, 1991, 1993
21f4ff850STim J. Robbins.\"	The Regents of the University of California.  All rights reserved.
31f4ff850STim J. Robbins.\"
41f4ff850STim J. Robbins.\" This code is derived from software contributed to Berkeley by
51f4ff850STim J. Robbins.\" Chris Torek and the American National Standards Committee X3,
61f4ff850STim J. Robbins.\" on Information Processing Systems.
71f4ff850STim J. Robbins.\"
81f4ff850STim J. Robbins.\" Redistribution and use in source and binary forms, with or without
91f4ff850STim J. Robbins.\" modification, are permitted provided that the following conditions
101f4ff850STim J. Robbins.\" are met:
111f4ff850STim J. Robbins.\" 1. Redistributions of source code must retain the above copyright
121f4ff850STim J. Robbins.\"    notice, this list of conditions and the following disclaimer.
131f4ff850STim J. Robbins.\" 2. Redistributions in binary form must reproduce the above copyright
141f4ff850STim J. Robbins.\"    notice, this list of conditions and the following disclaimer in the
151f4ff850STim J. Robbins.\"    documentation and/or other materials provided with the distribution.
16*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
171f4ff850STim J. Robbins.\"    may be used to endorse or promote products derived from this software
181f4ff850STim J. Robbins.\"    without specific prior written permission.
191f4ff850STim J. Robbins.\"
201f4ff850STim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
211f4ff850STim J. Robbins.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
221f4ff850STim J. Robbins.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
231f4ff850STim J. Robbins.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
241f4ff850STim J. Robbins.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
251f4ff850STim J. Robbins.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
261f4ff850STim J. Robbins.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
271f4ff850STim J. Robbins.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
281f4ff850STim J. Robbins.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
291f4ff850STim J. Robbins.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
301f4ff850STim J. Robbins.\" SUCH DAMAGE.
31759f7dc3STim J. Robbins.\" FreeBSD: src/lib/libc/stdio/scanf.3,v 1.24 2003/06/28 09:03:25 das Exp
321f4ff850STim J. Robbins.\"
33759f7dc3STim J. Robbins.Dd July 5, 2003
341f4ff850STim J. Robbins.Dt WSCANF 3
351f4ff850STim J. Robbins.Os
361f4ff850STim J. Robbins.Sh NAME
371f4ff850STim J. Robbins.Nm wscanf ,
381f4ff850STim J. Robbins.Nm fwscanf ,
391f4ff850STim J. Robbins.Nm swscanf ,
401f4ff850STim J. Robbins.Nm vwscanf ,
411f4ff850STim J. Robbins.Nm vswscanf ,
421f4ff850STim J. Robbins.Nm vfwscanf
431f4ff850STim J. Robbins.Nd wide character input format conversion
441f4ff850STim J. Robbins.Sh LIBRARY
451f4ff850STim J. Robbins.Lb libc
461f4ff850STim J. Robbins.Sh SYNOPSIS
471f4ff850STim J. Robbins.In stdio.h
481f4ff850STim J. Robbins.In wchar.h
491f4ff850STim J. Robbins.Ft int
501f4ff850STim J. Robbins.Fn wscanf "const wchar_t * restrict format" ...
511f4ff850STim J. Robbins.Ft int
521f4ff850STim J. Robbins.Fn fwscanf "FILE * restrict stream" "const wchar_t * restrict format" ...
531f4ff850STim J. Robbins.Ft int
541f4ff850STim J. Robbins.Fn swscanf "const wchar_t * restrict str" "const wchar_t * restrict format" ...
551f4ff850STim J. Robbins.In stdarg.h
561f4ff850STim J. Robbins.Ft int
571f4ff850STim J. Robbins.Fn vwscanf "const wchar_t * restrict format" "va_list ap"
581f4ff850STim J. Robbins.Ft int
591f4ff850STim J. Robbins.Fn vswscanf "const wchar_t * restrict str" "const wchar_t * restrict format" "va_list ap"
601f4ff850STim J. Robbins.Ft int
611f4ff850STim J. Robbins.Fn vfwscanf "FILE * restrict stream" "const wchar_t * restrict format" "va_list ap"
621f4ff850STim J. Robbins.Sh DESCRIPTION
631f4ff850STim J. RobbinsThe
641f4ff850STim J. Robbins.Fn wscanf
651f4ff850STim J. Robbinsfamily of functions scans input according to a
661f4ff850STim J. Robbins.Fa format
671f4ff850STim J. Robbinsas described below.
681f4ff850STim J. RobbinsThis format may contain
691f4ff850STim J. Robbins.Em conversion specifiers ;
701f4ff850STim J. Robbinsthe results from such conversions, if any,
711f4ff850STim J. Robbinsare stored through the
721f4ff850STim J. Robbins.Em pointer
731f4ff850STim J. Robbinsarguments.
741f4ff850STim J. RobbinsThe
751f4ff850STim J. Robbins.Fn wscanf
761f4ff850STim J. Robbinsfunction
771f4ff850STim J. Robbinsreads input from the standard input stream
78ae828962SRuslan Ermilov.Dv stdin ,
791f4ff850STim J. Robbins.Fn fwscanf
801f4ff850STim J. Robbinsreads input from the stream pointer
811f4ff850STim J. Robbins.Fa stream ,
821f4ff850STim J. Robbinsand
831f4ff850STim J. Robbins.Fn swscanf
841f4ff850STim J. Robbinsreads its input from the wide character string pointed to by
851f4ff850STim J. Robbins.Fa str .
861f4ff850STim J. RobbinsThe
871f4ff850STim J. Robbins.Fn vfwscanf
881f4ff850STim J. Robbinsfunction
891f4ff850STim J. Robbinsis analogous to
901f4ff850STim J. Robbins.Xr vfwprintf 3
911f4ff850STim J. Robbinsand reads input from the stream pointer
921f4ff850STim J. Robbins.Fa stream
931f4ff850STim J. Robbinsusing a variable argument list of pointers (see
941f4ff850STim J. Robbins.Xr stdarg 3 ) .
951f4ff850STim J. RobbinsThe
961f4ff850STim J. Robbins.Fn vwscanf
971f4ff850STim J. Robbinsfunction scans a variable argument list from the standard input and
981f4ff850STim J. Robbinsthe
991f4ff850STim J. Robbins.Fn vswscanf
1001f4ff850STim J. Robbinsfunction scans it from a wide character string;
1011f4ff850STim J. Robbinsthese are analogous to
1021f4ff850STim J. Robbinsthe
1031f4ff850STim J. Robbins.Fn vwprintf
1041f4ff850STim J. Robbinsand
1051f4ff850STim J. Robbins.Fn vswprintf
1061f4ff850STim J. Robbinsfunctions respectively.
1071f4ff850STim J. RobbinsEach successive
1081f4ff850STim J. Robbins.Em pointer
1091f4ff850STim J. Robbinsargument must correspond properly with
1101f4ff850STim J. Robbinseach successive conversion specifier
1111f4ff850STim J. Robbins(but see the
1121f4ff850STim J. Robbins.Cm *
1131f4ff850STim J. Robbinsconversion below).
1141f4ff850STim J. RobbinsAll conversions are introduced by the
1151f4ff850STim J. Robbins.Cm %
1161f4ff850STim J. Robbins(percent sign) character.
1171f4ff850STim J. RobbinsThe
1181f4ff850STim J. Robbins.Fa format
1191f4ff850STim J. Robbinsstring
1201f4ff850STim J. Robbinsmay also contain other characters.
1211f4ff850STim J. RobbinsWhite space (such as blanks, tabs, or newlines) in the
1221f4ff850STim J. Robbins.Fa format
1231f4ff850STim J. Robbinsstring match any amount of white space, including none, in the input.
1241f4ff850STim J. RobbinsEverything else
1251f4ff850STim J. Robbinsmatches only itself.
1261f4ff850STim J. RobbinsScanning stops
1271f4ff850STim J. Robbinswhen an input character does not match such a format character.
1281f4ff850STim J. RobbinsScanning also stops
1291f4ff850STim J. Robbinswhen an input conversion cannot be made (see below).
1301f4ff850STim J. Robbins.Sh CONVERSIONS
1311f4ff850STim J. RobbinsFollowing the
1321f4ff850STim J. Robbins.Cm %
1331f4ff850STim J. Robbinscharacter introducing a conversion
1341f4ff850STim J. Robbinsthere may be a number of
1351f4ff850STim J. Robbins.Em flag
1361f4ff850STim J. Robbinscharacters, as follows:
1371f4ff850STim J. Robbins.Bl -tag -width ".Cm l No (ell)"
1381f4ff850STim J. Robbins.It Cm *
1391f4ff850STim J. RobbinsSuppresses assignment.
1401f4ff850STim J. RobbinsThe conversion that follows occurs as usual, but no pointer is used;
1411f4ff850STim J. Robbinsthe result of the conversion is simply discarded.
1421f4ff850STim J. Robbins.It Cm hh
1431f4ff850STim J. RobbinsIndicates that the conversion will be one of
1441f4ff850STim J. Robbins.Cm dioux
1451f4ff850STim J. Robbinsor
1461f4ff850STim J. Robbins.Cm n
1471f4ff850STim J. Robbinsand the next pointer is a pointer to a
1481f4ff850STim J. Robbins.Vt char
1491f4ff850STim J. Robbins(rather than
1501f4ff850STim J. Robbins.Vt int ) .
1511f4ff850STim J. Robbins.It Cm h
1521f4ff850STim J. RobbinsIndicates that the conversion will be one of
1531f4ff850STim J. Robbins.Cm dioux
1541f4ff850STim J. Robbinsor
1551f4ff850STim J. Robbins.Cm n
1561f4ff850STim J. Robbinsand the next pointer is a pointer to a
1571f4ff850STim J. Robbins.Vt "short int"
1581f4ff850STim J. Robbins(rather than
1591f4ff850STim J. Robbins.Vt int ) .
1601f4ff850STim J. Robbins.It Cm l No (ell)
1611f4ff850STim J. RobbinsIndicates that the conversion will be one of
1621f4ff850STim J. Robbins.Cm dioux
1631f4ff850STim J. Robbinsor
1641f4ff850STim J. Robbins.Cm n
1651f4ff850STim J. Robbinsand the next pointer is a pointer to a
1661f4ff850STim J. Robbins.Vt "long int"
1671f4ff850STim J. Robbins(rather than
1681f4ff850STim J. Robbins.Vt int ) ,
1691f4ff850STim J. Robbinsthat the conversion will be one of
170759f7dc3STim J. Robbins.Cm a , e , f ,
171759f7dc3STim J. Robbinsor
172759f7dc3STim J. Robbins.Cm g
1731f4ff850STim J. Robbinsand the next pointer is a pointer to
1741f4ff850STim J. Robbins.Vt double
1751f4ff850STim J. Robbins(rather than
1761f4ff850STim J. Robbins.Vt float ) ,
1771f4ff850STim J. Robbinsor that the conversion will be one of
1781f4ff850STim J. Robbins.Cm c
1791f4ff850STim J. Robbinsor
1801f4ff850STim J. Robbins.Cm s
1811f4ff850STim J. Robbinsand the next pointer is a pointer to an array of
1821f4ff850STim J. Robbins.Vt wchar_t
1831f4ff850STim J. Robbins(rather than
1841f4ff850STim J. Robbins.Vt char ) .
1851f4ff850STim J. Robbins.It Cm ll No (ell ell)
1861f4ff850STim J. RobbinsIndicates that the conversion will be one of
1871f4ff850STim J. Robbins.Cm dioux
1881f4ff850STim J. Robbinsor
1891f4ff850STim J. Robbins.Cm n
1901f4ff850STim J. Robbinsand the next pointer is a pointer to a
1911f4ff850STim J. Robbins.Vt "long long int"
1921f4ff850STim J. Robbins(rather than
1931f4ff850STim J. Robbins.Vt int ) .
1941f4ff850STim J. Robbins.It Cm L
1951f4ff850STim J. RobbinsIndicates that the conversion will be one of
196759f7dc3STim J. Robbins.Cm a , e , f ,
1971f4ff850STim J. Robbinsor
1981f4ff850STim J. Robbins.Cm g
1991f4ff850STim J. Robbinsand the next pointer is a pointer to
2001f4ff850STim J. Robbins.Vt "long double" .
2011f4ff850STim J. Robbins.It Cm j
2021f4ff850STim J. RobbinsIndicates that the conversion will be one of
2031f4ff850STim J. Robbins.Cm dioux
2041f4ff850STim J. Robbinsor
2051f4ff850STim J. Robbins.Cm n
2061f4ff850STim J. Robbinsand the next pointer is a pointer to a
2071f4ff850STim J. Robbins.Vt intmax_t
2081f4ff850STim J. Robbins(rather than
2091f4ff850STim J. Robbins.Vt int ) .
2101f4ff850STim J. Robbins.It Cm t
2111f4ff850STim J. RobbinsIndicates that the conversion will be one of
2121f4ff850STim J. Robbins.Cm dioux
2131f4ff850STim J. Robbinsor
2141f4ff850STim J. Robbins.Cm n
2151f4ff850STim J. Robbinsand the next pointer is a pointer to a
2161f4ff850STim J. Robbins.Vt ptrdiff_t
2171f4ff850STim J. Robbins(rather than
2181f4ff850STim J. Robbins.Vt int ) .
2191f4ff850STim J. Robbins.It Cm z
2201f4ff850STim J. RobbinsIndicates that the conversion will be one of
2211f4ff850STim J. Robbins.Cm dioux
2221f4ff850STim J. Robbinsor
2231f4ff850STim J. Robbins.Cm n
2241f4ff850STim J. Robbinsand the next pointer is a pointer to a
2251f4ff850STim J. Robbins.Vt size_t
2261f4ff850STim J. Robbins(rather than
2271f4ff850STim J. Robbins.Vt int ) .
2281f4ff850STim J. Robbins.It Cm q
2291f4ff850STim J. Robbins(deprecated.)
2301f4ff850STim J. RobbinsIndicates that the conversion will be one of
2311f4ff850STim J. Robbins.Cm dioux
2321f4ff850STim J. Robbinsor
2331f4ff850STim J. Robbins.Cm n
2341f4ff850STim J. Robbinsand the next pointer is a pointer to a
2351f4ff850STim J. Robbins.Vt "long long int"
2361f4ff850STim J. Robbins(rather than
2371f4ff850STim J. Robbins.Vt int ) .
2381f4ff850STim J. Robbins.El
2391f4ff850STim J. Robbins.Pp
2401f4ff850STim J. RobbinsIn addition to these flags,
2411f4ff850STim J. Robbinsthere may be an optional maximum field width,
2421f4ff850STim J. Robbinsexpressed as a decimal integer,
2431f4ff850STim J. Robbinsbetween the
2441f4ff850STim J. Robbins.Cm %
2451f4ff850STim J. Robbinsand the conversion.
2461f4ff850STim J. RobbinsIf no width is given,
2471f4ff850STim J. Robbinsa default of
2481f4ff850STim J. Robbins.Dq infinity
2491f4ff850STim J. Robbinsis used (with one exception, below);
2501f4ff850STim J. Robbinsotherwise at most this many characters are scanned
2511f4ff850STim J. Robbinsin processing the conversion.
2521f4ff850STim J. RobbinsBefore conversion begins,
2531f4ff850STim J. Robbinsmost conversions skip white space;
2541f4ff850STim J. Robbinsthis white space is not counted against the field width.
2551f4ff850STim J. Robbins.Pp
2561f4ff850STim J. RobbinsThe following conversions are available:
2571f4ff850STim J. Robbins.Bl -tag -width XXXX
2581f4ff850STim J. Robbins.It Cm %
2591f4ff850STim J. RobbinsMatches a literal
2601f4ff850STim J. Robbins.Ql % .
2611f4ff850STim J. RobbinsThat is,
2621f4ff850STim J. Robbins.Dq Li %%
2631f4ff850STim J. Robbinsin the format string
2641f4ff850STim J. Robbinsmatches a single input
2651f4ff850STim J. Robbins.Ql %
2661f4ff850STim J. Robbinscharacter.
2671f4ff850STim J. RobbinsNo conversion is done, and assignment does not occur.
2681f4ff850STim J. Robbins.It Cm d
2691f4ff850STim J. RobbinsMatches an optionally signed decimal integer;
2701f4ff850STim J. Robbinsthe next pointer must be a pointer to
2711f4ff850STim J. Robbins.Vt int .
2721f4ff850STim J. Robbins.It Cm i
2731f4ff850STim J. RobbinsMatches an optionally signed integer;
2741f4ff850STim J. Robbinsthe next pointer must be a pointer to
2751f4ff850STim J. Robbins.Vt int .
2761f4ff850STim J. RobbinsThe integer is read in base 16 if it begins
2771f4ff850STim J. Robbinswith
2781f4ff850STim J. Robbins.Ql 0x
2791f4ff850STim J. Robbinsor
2801f4ff850STim J. Robbins.Ql 0X ,
2811f4ff850STim J. Robbinsin base 8 if it begins with
2821f4ff850STim J. Robbins.Ql 0 ,
2831f4ff850STim J. Robbinsand in base 10 otherwise.
2841f4ff850STim J. RobbinsOnly characters that correspond to the base are used.
2851f4ff850STim J. Robbins.It Cm o
2861f4ff850STim J. RobbinsMatches an octal integer;
2871f4ff850STim J. Robbinsthe next pointer must be a pointer to
2881f4ff850STim J. Robbins.Vt "unsigned int" .
2891f4ff850STim J. Robbins.It Cm u
2901f4ff850STim J. RobbinsMatches an optionally signed decimal integer;
2911f4ff850STim J. Robbinsthe next pointer must be a pointer to
2921f4ff850STim J. Robbins.Vt "unsigned int" .
2931f4ff850STim J. Robbins.It Cm x , X
2941f4ff850STim J. RobbinsMatches an optionally signed hexadecimal integer;
2951f4ff850STim J. Robbinsthe next pointer must be a pointer to
2961f4ff850STim J. Robbins.Vt "unsigned int" .
297759f7dc3STim J. Robbins.It Cm a , A , e , E , f , F , g , G
298759f7dc3STim J. RobbinsMatches a floating-point number in the style of
299759f7dc3STim J. Robbins.Xr wcstod 3 .
300759f7dc3STim J. RobbinsThe next pointer must be a pointer to
301759f7dc3STim J. Robbins.Vt float
302759f7dc3STim J. Robbins(unless
303759f7dc3STim J. Robbins.Cm l
304759f7dc3STim J. Robbinsor
305759f7dc3STim J. Robbins.Cm L
306759f7dc3STim J. Robbinsis specified.)
3071f4ff850STim J. Robbins.It Cm s
3081f4ff850STim J. RobbinsMatches a sequence of non-white-space wide characters;
3091f4ff850STim J. Robbinsthe next pointer must be a pointer to
3101f4ff850STim J. Robbins.Vt char ,
3111f4ff850STim J. Robbinsand the array must be large enough to accept the multibyte representation
3121f4ff850STim J. Robbinsof all the sequence and the
3131f4ff850STim J. Robbinsterminating
3141f4ff850STim J. Robbins.Dv NUL
3151f4ff850STim J. Robbinscharacter.
3161f4ff850STim J. RobbinsThe input string stops at white space
3171f4ff850STim J. Robbinsor at the maximum field width, whichever occurs first.
3181f4ff850STim J. Robbins.Pp
3191f4ff850STim J. RobbinsIf an
3201f4ff850STim J. Robbins.Cm l
3211f4ff850STim J. Robbinsqualifier is present, the next pointer must be a pointer to
3221f4ff850STim J. Robbins.Vt wchar_t ,
3231f4ff850STim J. Robbinsinto which the input will be placed.
3241f4ff850STim J. Robbins.It Cm S
3251f4ff850STim J. RobbinsThe same as
3261f4ff850STim J. Robbins.Cm ls .
3271f4ff850STim J. Robbins.It Cm c
3281f4ff850STim J. RobbinsMatches a sequence of
3291f4ff850STim J. Robbins.Em width
3301f4ff850STim J. Robbinscount
3311f4ff850STim J. Robbinswide characters (default 1);
3321f4ff850STim J. Robbinsthe next pointer must be a pointer to
3331f4ff850STim J. Robbins.Vt char ,
3341f4ff850STim J. Robbinsand there must be enough room for the multibyte representation
3351f4ff850STim J. Robbinsof all the characters
3361f4ff850STim J. Robbins(no terminating
3371f4ff850STim J. Robbins.Dv NUL
3381f4ff850STim J. Robbinsis added).
3391f4ff850STim J. RobbinsThe usual skip of leading white space is suppressed.
3401f4ff850STim J. RobbinsTo skip white space first, use an explicit space in the format.
3411f4ff850STim J. Robbins.Pp
3421f4ff850STim J. RobbinsIf an
3431f4ff850STim J. Robbins.Cm l
3441f4ff850STim J. Robbinsqualifier is present, the next pointer must be a pointer to
3451f4ff850STim J. Robbins.Vt wchar_t ,
3461f4ff850STim J. Robbinsinto which the input will be placed.
3471f4ff850STim J. Robbins.It Cm C
3481f4ff850STim J. RobbinsThe same as
3491f4ff850STim J. Robbins.Cm lc .
3501f4ff850STim J. Robbins.It Cm \&[
3511f4ff850STim J. RobbinsMatches a nonempty sequence of characters from the specified set
3521f4ff850STim J. Robbinsof accepted characters;
3531f4ff850STim J. Robbinsthe next pointer must be a pointer to
3541f4ff850STim J. Robbins.Vt char ,
3551f4ff850STim J. Robbinsand there must be enough room for the multibyte representation of
3561f4ff850STim J. Robbinsall the characters in the string,
3571f4ff850STim J. Robbinsplus a terminating
3581f4ff850STim J. Robbins.Dv NUL
3591f4ff850STim J. Robbinscharacter.
3601f4ff850STim J. RobbinsThe usual skip of leading white space is suppressed.
3611f4ff850STim J. RobbinsThe string is to be made up of characters in
3621f4ff850STim J. Robbins(or not in)
3631f4ff850STim J. Robbinsa particular set;
3641f4ff850STim J. Robbinsthe set is defined by the characters between the open bracket
365790752beSJoel Dahl.Cm \&[
3661f4ff850STim J. Robbinscharacter
3671f4ff850STim J. Robbinsand a close bracket
368790752beSJoel Dahl.Cm \&]
3691f4ff850STim J. Robbinscharacter.
3701f4ff850STim J. RobbinsThe set
3711f4ff850STim J. Robbins.Em excludes
3721f4ff850STim J. Robbinsthose characters
3731f4ff850STim J. Robbinsif the first character after the open bracket is a circumflex
3741f4ff850STim J. Robbins.Cm ^ .
3751f4ff850STim J. RobbinsTo include a close bracket in the set,
3761f4ff850STim J. Robbinsmake it the first character after the open bracket
3771f4ff850STim J. Robbinsor the circumflex;
3781f4ff850STim J. Robbinsany other position will end the set.
3791f4ff850STim J. RobbinsTo include a hyphen in the set,
3801f4ff850STim J. Robbinsmake it the last character before the final close bracket;
3811f4ff850STim J. Robbinssome implementations of
3821f4ff850STim J. Robbins.Fn wscanf
3831f4ff850STim J. Robbinsuse
384a9a15f3eSRuslan Ermilov.Dq Li A-Z
3851f4ff850STim J. Robbinsto represent the range of characters between
386a9a15f3eSRuslan Ermilov.Ql A
3871f4ff850STim J. Robbinsand
388a9a15f3eSRuslan Ermilov.Ql Z .
3891f4ff850STim J. RobbinsThe string ends with the appearance of a character not in the
3901f4ff850STim J. Robbins(or, with a circumflex, in) set
3911f4ff850STim J. Robbinsor when the field width runs out.
3921f4ff850STim J. Robbins.Pp
3931f4ff850STim J. RobbinsIf an
3941f4ff850STim J. Robbins.Cm l
3951f4ff850STim J. Robbinsqualifier is present, the next pointer must be a pointer to
3961f4ff850STim J. Robbins.Vt wchar_t ,
3971f4ff850STim J. Robbinsinto which the input will be placed.
3981f4ff850STim J. Robbins.It Cm p
3991f4ff850STim J. RobbinsMatches a pointer value (as printed by
4001f4ff850STim J. Robbins.Ql %p
4011f4ff850STim J. Robbinsin
4021f4ff850STim J. Robbins.Xr wprintf 3 ) ;
4031f4ff850STim J. Robbinsthe next pointer must be a pointer to
4041f4ff850STim J. Robbins.Vt void .
4051f4ff850STim J. Robbins.It Cm n
4061f4ff850STim J. RobbinsNothing is expected;
4071f4ff850STim J. Robbinsinstead, the number of characters consumed thus far from the input
4081f4ff850STim J. Robbinsis stored through the next pointer,
4091f4ff850STim J. Robbinswhich must be a pointer to
4101f4ff850STim J. Robbins.Vt int .
4111f4ff850STim J. RobbinsThis is
4121f4ff850STim J. Robbins.Em not
4131f4ff850STim J. Robbinsa conversion, although it can be suppressed with the
4141f4ff850STim J. Robbins.Cm *
4151f4ff850STim J. Robbinsflag.
4161f4ff850STim J. Robbins.El
4171f4ff850STim J. Robbins.Pp
4181f4ff850STim J. RobbinsThe decimal point
4191f4ff850STim J. Robbinscharacter is defined in the program's locale (category
4201f4ff850STim J. Robbins.Dv LC_NUMERIC ) .
4211f4ff850STim J. Robbins.Pp
4221f4ff850STim J. RobbinsFor backwards compatibility, a
4231f4ff850STim J. Robbins.Dq conversion
4241f4ff850STim J. Robbinsof
4251f4ff850STim J. Robbins.Ql %\e0
4261f4ff850STim J. Robbinscauses an immediate return of
4271f4ff850STim J. Robbins.Dv EOF .
4281f4ff850STim J. Robbins.Sh RETURN VALUES
4291f4ff850STim J. RobbinsThese
4301f4ff850STim J. Robbinsfunctions
4311f4ff850STim J. Robbinsreturn
4321f4ff850STim J. Robbinsthe number of input items assigned, which can be fewer than provided
4331f4ff850STim J. Robbinsfor, or even zero, in the event of a matching failure.
4341f4ff850STim J. RobbinsZero
4351f4ff850STim J. Robbinsindicates that, while there was input available,
4361f4ff850STim J. Robbinsno conversions were assigned;
4371f4ff850STim J. Robbinstypically this is due to an invalid input character,
4381f4ff850STim J. Robbinssuch as an alphabetic character for a
4391f4ff850STim J. Robbins.Ql %d
4401f4ff850STim J. Robbinsconversion.
4411f4ff850STim J. RobbinsThe value
4421f4ff850STim J. Robbins.Dv EOF
4431f4ff850STim J. Robbinsis returned if an input failure occurs before any conversion such as an
4441f4ff850STim J. Robbinsend-of-file occurs.
4451f4ff850STim J. RobbinsIf an error or end-of-file occurs after conversion
4461f4ff850STim J. Robbinshas begun,
4471f4ff850STim J. Robbinsthe number of conversions which were successfully completed is returned.
4481f4ff850STim J. Robbins.Sh SEE ALSO
4491f4ff850STim J. Robbins.Xr fgetwc 3 ,
45038b5abadSTim J. Robbins.Xr scanf 3 ,
4511f4ff850STim J. Robbins.Xr wcrtomb 3 ,
4521f4ff850STim J. Robbins.Xr wcstod 3 ,
4531f4ff850STim J. Robbins.Xr wcstol 3 ,
4541f4ff850STim J. Robbins.Xr wcstoul 3 ,
4551f4ff850STim J. Robbins.Xr wprintf 3
4561f4ff850STim J. Robbins.Sh STANDARDS
4571f4ff850STim J. RobbinsThe
4581f4ff850STim J. Robbins.Fn fwscanf ,
4591f4ff850STim J. Robbins.Fn wscanf ,
4601f4ff850STim J. Robbins.Fn swscanf ,
4611f4ff850STim J. Robbins.Fn vfwscanf ,
4621f4ff850STim J. Robbins.Fn vwscanf
4631f4ff850STim J. Robbinsand
4641f4ff850STim J. Robbins.Fn vswscanf
4651f4ff850STim J. Robbinsfunctions
4661f4ff850STim J. Robbinsconform to
4671f4ff850STim J. Robbins.St -isoC-99 .
4681f4ff850STim J. Robbins.Sh BUGS
4691f4ff850STim J. RobbinsIn addition to the bugs documented in
4701f4ff850STim J. Robbins.Xr scanf 3 ,
4711f4ff850STim J. Robbins.Fn wscanf
4721f4ff850STim J. Robbinsdoes not support the
473a9a15f3eSRuslan Ermilov.Dq Li A-Z
4741f4ff850STim J. Robbinsnotation for specifying character ranges with the character
4751f4ff850STim J. Robbinsclass conversion
4761f4ff850STim J. Robbins.Pq Sq Cm %[ .
477