xref: /freebsd/lib/libc/stdio/wscanf.3 (revision fbbd9655e5107c68e4e0146ff22b73d7350475bc)
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.
311f4ff850STim J. Robbins.\"
321f4ff850STim J. Robbins.\"     @(#)scanf.3	8.2 (Berkeley) 12/11/93
33759f7dc3STim J. Robbins.\" FreeBSD: src/lib/libc/stdio/scanf.3,v 1.24 2003/06/28 09:03:25 das Exp
341f4ff850STim J. Robbins.\" $FreeBSD$
351f4ff850STim J. Robbins.\"
36759f7dc3STim J. Robbins.Dd July 5, 2003
371f4ff850STim J. Robbins.Dt WSCANF 3
381f4ff850STim J. Robbins.Os
391f4ff850STim J. Robbins.Sh NAME
401f4ff850STim J. Robbins.Nm wscanf ,
411f4ff850STim J. Robbins.Nm fwscanf ,
421f4ff850STim J. Robbins.Nm swscanf ,
431f4ff850STim J. Robbins.Nm vwscanf ,
441f4ff850STim J. Robbins.Nm vswscanf ,
451f4ff850STim J. Robbins.Nm vfwscanf
461f4ff850STim J. Robbins.Nd wide character input format conversion
471f4ff850STim J. Robbins.Sh LIBRARY
481f4ff850STim J. Robbins.Lb libc
491f4ff850STim J. Robbins.Sh SYNOPSIS
501f4ff850STim J. Robbins.In stdio.h
511f4ff850STim J. Robbins.In wchar.h
521f4ff850STim J. Robbins.Ft int
531f4ff850STim J. Robbins.Fn wscanf "const wchar_t * restrict format" ...
541f4ff850STim J. Robbins.Ft int
551f4ff850STim J. Robbins.Fn fwscanf "FILE * restrict stream" "const wchar_t * restrict format" ...
561f4ff850STim J. Robbins.Ft int
571f4ff850STim J. Robbins.Fn swscanf "const wchar_t * restrict str" "const wchar_t * restrict format" ...
581f4ff850STim J. Robbins.In stdarg.h
591f4ff850STim J. Robbins.Ft int
601f4ff850STim J. Robbins.Fn vwscanf "const wchar_t * restrict format" "va_list ap"
611f4ff850STim J. Robbins.Ft int
621f4ff850STim J. Robbins.Fn vswscanf "const wchar_t * restrict str" "const wchar_t * restrict format" "va_list ap"
631f4ff850STim J. Robbins.Ft int
641f4ff850STim J. Robbins.Fn vfwscanf "FILE * restrict stream" "const wchar_t * restrict format" "va_list ap"
651f4ff850STim J. Robbins.Sh DESCRIPTION
661f4ff850STim J. RobbinsThe
671f4ff850STim J. Robbins.Fn wscanf
681f4ff850STim J. Robbinsfamily of functions scans input according to a
691f4ff850STim J. Robbins.Fa format
701f4ff850STim J. Robbinsas described below.
711f4ff850STim J. RobbinsThis format may contain
721f4ff850STim J. Robbins.Em conversion specifiers ;
731f4ff850STim J. Robbinsthe results from such conversions, if any,
741f4ff850STim J. Robbinsare stored through the
751f4ff850STim J. Robbins.Em pointer
761f4ff850STim J. Robbinsarguments.
771f4ff850STim J. RobbinsThe
781f4ff850STim J. Robbins.Fn wscanf
791f4ff850STim J. Robbinsfunction
801f4ff850STim J. Robbinsreads input from the standard input stream
81ae828962SRuslan Ermilov.Dv stdin ,
821f4ff850STim J. Robbins.Fn fwscanf
831f4ff850STim J. Robbinsreads input from the stream pointer
841f4ff850STim J. Robbins.Fa stream ,
851f4ff850STim J. Robbinsand
861f4ff850STim J. Robbins.Fn swscanf
871f4ff850STim J. Robbinsreads its input from the wide character string pointed to by
881f4ff850STim J. Robbins.Fa str .
891f4ff850STim J. RobbinsThe
901f4ff850STim J. Robbins.Fn vfwscanf
911f4ff850STim J. Robbinsfunction
921f4ff850STim J. Robbinsis analogous to
931f4ff850STim J. Robbins.Xr vfwprintf 3
941f4ff850STim J. Robbinsand reads input from the stream pointer
951f4ff850STim J. Robbins.Fa stream
961f4ff850STim J. Robbinsusing a variable argument list of pointers (see
971f4ff850STim J. Robbins.Xr stdarg 3 ) .
981f4ff850STim J. RobbinsThe
991f4ff850STim J. Robbins.Fn vwscanf
1001f4ff850STim J. Robbinsfunction scans a variable argument list from the standard input and
1011f4ff850STim J. Robbinsthe
1021f4ff850STim J. Robbins.Fn vswscanf
1031f4ff850STim J. Robbinsfunction scans it from a wide character string;
1041f4ff850STim J. Robbinsthese are analogous to
1051f4ff850STim J. Robbinsthe
1061f4ff850STim J. Robbins.Fn vwprintf
1071f4ff850STim J. Robbinsand
1081f4ff850STim J. Robbins.Fn vswprintf
1091f4ff850STim J. Robbinsfunctions respectively.
1101f4ff850STim J. RobbinsEach successive
1111f4ff850STim J. Robbins.Em pointer
1121f4ff850STim J. Robbinsargument must correspond properly with
1131f4ff850STim J. Robbinseach successive conversion specifier
1141f4ff850STim J. Robbins(but see the
1151f4ff850STim J. Robbins.Cm *
1161f4ff850STim J. Robbinsconversion below).
1171f4ff850STim J. RobbinsAll conversions are introduced by the
1181f4ff850STim J. Robbins.Cm %
1191f4ff850STim J. Robbins(percent sign) character.
1201f4ff850STim J. RobbinsThe
1211f4ff850STim J. Robbins.Fa format
1221f4ff850STim J. Robbinsstring
1231f4ff850STim J. Robbinsmay also contain other characters.
1241f4ff850STim J. RobbinsWhite space (such as blanks, tabs, or newlines) in the
1251f4ff850STim J. Robbins.Fa format
1261f4ff850STim J. Robbinsstring match any amount of white space, including none, in the input.
1271f4ff850STim J. RobbinsEverything else
1281f4ff850STim J. Robbinsmatches only itself.
1291f4ff850STim J. RobbinsScanning stops
1301f4ff850STim J. Robbinswhen an input character does not match such a format character.
1311f4ff850STim J. RobbinsScanning also stops
1321f4ff850STim J. Robbinswhen an input conversion cannot be made (see below).
1331f4ff850STim J. Robbins.Sh CONVERSIONS
1341f4ff850STim J. RobbinsFollowing the
1351f4ff850STim J. Robbins.Cm %
1361f4ff850STim J. Robbinscharacter introducing a conversion
1371f4ff850STim J. Robbinsthere may be a number of
1381f4ff850STim J. Robbins.Em flag
1391f4ff850STim J. Robbinscharacters, as follows:
1401f4ff850STim J. Robbins.Bl -tag -width ".Cm l No (ell)"
1411f4ff850STim J. Robbins.It Cm *
1421f4ff850STim J. RobbinsSuppresses assignment.
1431f4ff850STim J. RobbinsThe conversion that follows occurs as usual, but no pointer is used;
1441f4ff850STim J. Robbinsthe result of the conversion is simply discarded.
1451f4ff850STim J. Robbins.It Cm hh
1461f4ff850STim J. RobbinsIndicates that the conversion will be one of
1471f4ff850STim J. Robbins.Cm dioux
1481f4ff850STim J. Robbinsor
1491f4ff850STim J. Robbins.Cm n
1501f4ff850STim J. Robbinsand the next pointer is a pointer to a
1511f4ff850STim J. Robbins.Vt char
1521f4ff850STim J. Robbins(rather than
1531f4ff850STim J. Robbins.Vt int ) .
1541f4ff850STim J. Robbins.It Cm h
1551f4ff850STim J. RobbinsIndicates that the conversion will be one of
1561f4ff850STim J. Robbins.Cm dioux
1571f4ff850STim J. Robbinsor
1581f4ff850STim J. Robbins.Cm n
1591f4ff850STim J. Robbinsand the next pointer is a pointer to a
1601f4ff850STim J. Robbins.Vt "short int"
1611f4ff850STim J. Robbins(rather than
1621f4ff850STim J. Robbins.Vt int ) .
1631f4ff850STim J. Robbins.It Cm l No (ell)
1641f4ff850STim J. RobbinsIndicates that the conversion will be one of
1651f4ff850STim J. Robbins.Cm dioux
1661f4ff850STim J. Robbinsor
1671f4ff850STim J. Robbins.Cm n
1681f4ff850STim J. Robbinsand the next pointer is a pointer to a
1691f4ff850STim J. Robbins.Vt "long int"
1701f4ff850STim J. Robbins(rather than
1711f4ff850STim J. Robbins.Vt int ) ,
1721f4ff850STim J. Robbinsthat the conversion will be one of
173759f7dc3STim J. Robbins.Cm a , e , f ,
174759f7dc3STim J. Robbinsor
175759f7dc3STim J. Robbins.Cm g
1761f4ff850STim J. Robbinsand the next pointer is a pointer to
1771f4ff850STim J. Robbins.Vt double
1781f4ff850STim J. Robbins(rather than
1791f4ff850STim J. Robbins.Vt float ) ,
1801f4ff850STim J. Robbinsor that the conversion will be one of
1811f4ff850STim J. Robbins.Cm c
1821f4ff850STim J. Robbinsor
1831f4ff850STim J. Robbins.Cm s
1841f4ff850STim J. Robbinsand the next pointer is a pointer to an array of
1851f4ff850STim J. Robbins.Vt wchar_t
1861f4ff850STim J. Robbins(rather than
1871f4ff850STim J. Robbins.Vt char ) .
1881f4ff850STim J. Robbins.It Cm ll No (ell ell)
1891f4ff850STim J. RobbinsIndicates that the conversion will be one of
1901f4ff850STim J. Robbins.Cm dioux
1911f4ff850STim J. Robbinsor
1921f4ff850STim J. Robbins.Cm n
1931f4ff850STim J. Robbinsand the next pointer is a pointer to a
1941f4ff850STim J. Robbins.Vt "long long int"
1951f4ff850STim J. Robbins(rather than
1961f4ff850STim J. Robbins.Vt int ) .
1971f4ff850STim J. Robbins.It Cm L
1981f4ff850STim J. RobbinsIndicates that the conversion will be one of
199759f7dc3STim J. Robbins.Cm a , e , f ,
2001f4ff850STim J. Robbinsor
2011f4ff850STim J. Robbins.Cm g
2021f4ff850STim J. Robbinsand the next pointer is a pointer to
2031f4ff850STim J. Robbins.Vt "long double" .
2041f4ff850STim J. Robbins.It Cm j
2051f4ff850STim J. RobbinsIndicates that the conversion will be one of
2061f4ff850STim J. Robbins.Cm dioux
2071f4ff850STim J. Robbinsor
2081f4ff850STim J. Robbins.Cm n
2091f4ff850STim J. Robbinsand the next pointer is a pointer to a
2101f4ff850STim J. Robbins.Vt intmax_t
2111f4ff850STim J. Robbins(rather than
2121f4ff850STim J. Robbins.Vt int ) .
2131f4ff850STim J. Robbins.It Cm t
2141f4ff850STim J. RobbinsIndicates that the conversion will be one of
2151f4ff850STim J. Robbins.Cm dioux
2161f4ff850STim J. Robbinsor
2171f4ff850STim J. Robbins.Cm n
2181f4ff850STim J. Robbinsand the next pointer is a pointer to a
2191f4ff850STim J. Robbins.Vt ptrdiff_t
2201f4ff850STim J. Robbins(rather than
2211f4ff850STim J. Robbins.Vt int ) .
2221f4ff850STim J. Robbins.It Cm z
2231f4ff850STim J. RobbinsIndicates that the conversion will be one of
2241f4ff850STim J. Robbins.Cm dioux
2251f4ff850STim J. Robbinsor
2261f4ff850STim J. Robbins.Cm n
2271f4ff850STim J. Robbinsand the next pointer is a pointer to a
2281f4ff850STim J. Robbins.Vt size_t
2291f4ff850STim J. Robbins(rather than
2301f4ff850STim J. Robbins.Vt int ) .
2311f4ff850STim J. Robbins.It Cm q
2321f4ff850STim J. Robbins(deprecated.)
2331f4ff850STim J. RobbinsIndicates that the conversion will be one of
2341f4ff850STim J. Robbins.Cm dioux
2351f4ff850STim J. Robbinsor
2361f4ff850STim J. Robbins.Cm n
2371f4ff850STim J. Robbinsand the next pointer is a pointer to a
2381f4ff850STim J. Robbins.Vt "long long int"
2391f4ff850STim J. Robbins(rather than
2401f4ff850STim J. Robbins.Vt int ) .
2411f4ff850STim J. Robbins.El
2421f4ff850STim J. Robbins.Pp
2431f4ff850STim J. RobbinsIn addition to these flags,
2441f4ff850STim J. Robbinsthere may be an optional maximum field width,
2451f4ff850STim J. Robbinsexpressed as a decimal integer,
2461f4ff850STim J. Robbinsbetween the
2471f4ff850STim J. Robbins.Cm %
2481f4ff850STim J. Robbinsand the conversion.
2491f4ff850STim J. RobbinsIf no width is given,
2501f4ff850STim J. Robbinsa default of
2511f4ff850STim J. Robbins.Dq infinity
2521f4ff850STim J. Robbinsis used (with one exception, below);
2531f4ff850STim J. Robbinsotherwise at most this many characters are scanned
2541f4ff850STim J. Robbinsin processing the conversion.
2551f4ff850STim J. RobbinsBefore conversion begins,
2561f4ff850STim J. Robbinsmost conversions skip white space;
2571f4ff850STim J. Robbinsthis white space is not counted against the field width.
2581f4ff850STim J. Robbins.Pp
2591f4ff850STim J. RobbinsThe following conversions are available:
2601f4ff850STim J. Robbins.Bl -tag -width XXXX
2611f4ff850STim J. Robbins.It Cm %
2621f4ff850STim J. RobbinsMatches a literal
2631f4ff850STim J. Robbins.Ql % .
2641f4ff850STim J. RobbinsThat is,
2651f4ff850STim J. Robbins.Dq Li %%
2661f4ff850STim J. Robbinsin the format string
2671f4ff850STim J. Robbinsmatches a single input
2681f4ff850STim J. Robbins.Ql %
2691f4ff850STim J. Robbinscharacter.
2701f4ff850STim J. RobbinsNo conversion is done, and assignment does not occur.
2711f4ff850STim J. Robbins.It Cm d
2721f4ff850STim J. RobbinsMatches an optionally signed decimal integer;
2731f4ff850STim J. Robbinsthe next pointer must be a pointer to
2741f4ff850STim J. Robbins.Vt int .
2751f4ff850STim J. Robbins.It Cm i
2761f4ff850STim J. RobbinsMatches an optionally signed integer;
2771f4ff850STim J. Robbinsthe next pointer must be a pointer to
2781f4ff850STim J. Robbins.Vt int .
2791f4ff850STim J. RobbinsThe integer is read in base 16 if it begins
2801f4ff850STim J. Robbinswith
2811f4ff850STim J. Robbins.Ql 0x
2821f4ff850STim J. Robbinsor
2831f4ff850STim J. Robbins.Ql 0X ,
2841f4ff850STim J. Robbinsin base 8 if it begins with
2851f4ff850STim J. Robbins.Ql 0 ,
2861f4ff850STim J. Robbinsand in base 10 otherwise.
2871f4ff850STim J. RobbinsOnly characters that correspond to the base are used.
2881f4ff850STim J. Robbins.It Cm o
2891f4ff850STim J. RobbinsMatches an octal integer;
2901f4ff850STim J. Robbinsthe next pointer must be a pointer to
2911f4ff850STim J. Robbins.Vt "unsigned int" .
2921f4ff850STim J. Robbins.It Cm u
2931f4ff850STim J. RobbinsMatches an optionally signed decimal integer;
2941f4ff850STim J. Robbinsthe next pointer must be a pointer to
2951f4ff850STim J. Robbins.Vt "unsigned int" .
2961f4ff850STim J. Robbins.It Cm x , X
2971f4ff850STim J. RobbinsMatches an optionally signed hexadecimal integer;
2981f4ff850STim J. Robbinsthe next pointer must be a pointer to
2991f4ff850STim J. Robbins.Vt "unsigned int" .
300759f7dc3STim J. Robbins.It Cm a , A , e , E , f , F , g , G
301759f7dc3STim J. RobbinsMatches a floating-point number in the style of
302759f7dc3STim J. Robbins.Xr wcstod 3 .
303759f7dc3STim J. RobbinsThe next pointer must be a pointer to
304759f7dc3STim J. Robbins.Vt float
305759f7dc3STim J. Robbins(unless
306759f7dc3STim J. Robbins.Cm l
307759f7dc3STim J. Robbinsor
308759f7dc3STim J. Robbins.Cm L
309759f7dc3STim J. Robbinsis specified.)
3101f4ff850STim J. Robbins.It Cm s
3111f4ff850STim J. RobbinsMatches a sequence of non-white-space wide characters;
3121f4ff850STim J. Robbinsthe next pointer must be a pointer to
3131f4ff850STim J. Robbins.Vt char ,
3141f4ff850STim J. Robbinsand the array must be large enough to accept the multibyte representation
3151f4ff850STim J. Robbinsof all the sequence and the
3161f4ff850STim J. Robbinsterminating
3171f4ff850STim J. Robbins.Dv NUL
3181f4ff850STim J. Robbinscharacter.
3191f4ff850STim J. RobbinsThe input string stops at white space
3201f4ff850STim J. Robbinsor at the maximum field width, whichever occurs first.
3211f4ff850STim J. Robbins.Pp
3221f4ff850STim J. RobbinsIf an
3231f4ff850STim J. Robbins.Cm l
3241f4ff850STim J. Robbinsqualifier is present, the next pointer must be a pointer to
3251f4ff850STim J. Robbins.Vt wchar_t ,
3261f4ff850STim J. Robbinsinto which the input will be placed.
3271f4ff850STim J. Robbins.It Cm S
3281f4ff850STim J. RobbinsThe same as
3291f4ff850STim J. Robbins.Cm ls .
3301f4ff850STim J. Robbins.It Cm c
3311f4ff850STim J. RobbinsMatches a sequence of
3321f4ff850STim J. Robbins.Em width
3331f4ff850STim J. Robbinscount
3341f4ff850STim J. Robbinswide characters (default 1);
3351f4ff850STim J. Robbinsthe next pointer must be a pointer to
3361f4ff850STim J. Robbins.Vt char ,
3371f4ff850STim J. Robbinsand there must be enough room for the multibyte representation
3381f4ff850STim J. Robbinsof all the characters
3391f4ff850STim J. Robbins(no terminating
3401f4ff850STim J. Robbins.Dv NUL
3411f4ff850STim J. Robbinsis added).
3421f4ff850STim J. RobbinsThe usual skip of leading white space is suppressed.
3431f4ff850STim J. RobbinsTo skip white space first, use an explicit space in the format.
3441f4ff850STim J. Robbins.Pp
3451f4ff850STim J. RobbinsIf an
3461f4ff850STim J. Robbins.Cm l
3471f4ff850STim J. Robbinsqualifier is present, the next pointer must be a pointer to
3481f4ff850STim J. Robbins.Vt wchar_t ,
3491f4ff850STim J. Robbinsinto which the input will be placed.
3501f4ff850STim J. Robbins.It Cm C
3511f4ff850STim J. RobbinsThe same as
3521f4ff850STim J. Robbins.Cm lc .
3531f4ff850STim J. Robbins.It Cm \&[
3541f4ff850STim J. RobbinsMatches a nonempty sequence of characters from the specified set
3551f4ff850STim J. Robbinsof accepted characters;
3561f4ff850STim J. Robbinsthe next pointer must be a pointer to
3571f4ff850STim J. Robbins.Vt char ,
3581f4ff850STim J. Robbinsand there must be enough room for the multibyte representation of
3591f4ff850STim J. Robbinsall the characters in the string,
3601f4ff850STim J. Robbinsplus a terminating
3611f4ff850STim J. Robbins.Dv NUL
3621f4ff850STim J. Robbinscharacter.
3631f4ff850STim J. RobbinsThe usual skip of leading white space is suppressed.
3641f4ff850STim J. RobbinsThe string is to be made up of characters in
3651f4ff850STim J. Robbins(or not in)
3661f4ff850STim J. Robbinsa particular set;
3671f4ff850STim J. Robbinsthe set is defined by the characters between the open bracket
368790752beSJoel Dahl.Cm \&[
3691f4ff850STim J. Robbinscharacter
3701f4ff850STim J. Robbinsand a close bracket
371790752beSJoel Dahl.Cm \&]
3721f4ff850STim J. Robbinscharacter.
3731f4ff850STim J. RobbinsThe set
3741f4ff850STim J. Robbins.Em excludes
3751f4ff850STim J. Robbinsthose characters
3761f4ff850STim J. Robbinsif the first character after the open bracket is a circumflex
3771f4ff850STim J. Robbins.Cm ^ .
3781f4ff850STim J. RobbinsTo include a close bracket in the set,
3791f4ff850STim J. Robbinsmake it the first character after the open bracket
3801f4ff850STim J. Robbinsor the circumflex;
3811f4ff850STim J. Robbinsany other position will end the set.
3821f4ff850STim J. RobbinsTo include a hyphen in the set,
3831f4ff850STim J. Robbinsmake it the last character before the final close bracket;
3841f4ff850STim J. Robbinssome implementations of
3851f4ff850STim J. Robbins.Fn wscanf
3861f4ff850STim J. Robbinsuse
387a9a15f3eSRuslan Ermilov.Dq Li A-Z
3881f4ff850STim J. Robbinsto represent the range of characters between
389a9a15f3eSRuslan Ermilov.Ql A
3901f4ff850STim J. Robbinsand
391a9a15f3eSRuslan Ermilov.Ql Z .
3921f4ff850STim J. RobbinsThe string ends with the appearance of a character not in the
3931f4ff850STim J. Robbins(or, with a circumflex, in) set
3941f4ff850STim J. Robbinsor when the field width runs out.
3951f4ff850STim J. Robbins.Pp
3961f4ff850STim J. RobbinsIf an
3971f4ff850STim J. Robbins.Cm l
3981f4ff850STim J. Robbinsqualifier is present, the next pointer must be a pointer to
3991f4ff850STim J. Robbins.Vt wchar_t ,
4001f4ff850STim J. Robbinsinto which the input will be placed.
4011f4ff850STim J. Robbins.It Cm p
4021f4ff850STim J. RobbinsMatches a pointer value (as printed by
4031f4ff850STim J. Robbins.Ql %p
4041f4ff850STim J. Robbinsin
4051f4ff850STim J. Robbins.Xr wprintf 3 ) ;
4061f4ff850STim J. Robbinsthe next pointer must be a pointer to
4071f4ff850STim J. Robbins.Vt void .
4081f4ff850STim J. Robbins.It Cm n
4091f4ff850STim J. RobbinsNothing is expected;
4101f4ff850STim J. Robbinsinstead, the number of characters consumed thus far from the input
4111f4ff850STim J. Robbinsis stored through the next pointer,
4121f4ff850STim J. Robbinswhich must be a pointer to
4131f4ff850STim J. Robbins.Vt int .
4141f4ff850STim J. RobbinsThis is
4151f4ff850STim J. Robbins.Em not
4161f4ff850STim J. Robbinsa conversion, although it can be suppressed with the
4171f4ff850STim J. Robbins.Cm *
4181f4ff850STim J. Robbinsflag.
4191f4ff850STim J. Robbins.El
4201f4ff850STim J. Robbins.Pp
4211f4ff850STim J. RobbinsThe decimal point
4221f4ff850STim J. Robbinscharacter is defined in the program's locale (category
4231f4ff850STim J. Robbins.Dv LC_NUMERIC ) .
4241f4ff850STim J. Robbins.Pp
4251f4ff850STim J. RobbinsFor backwards compatibility, a
4261f4ff850STim J. Robbins.Dq conversion
4271f4ff850STim J. Robbinsof
4281f4ff850STim J. Robbins.Ql %\e0
4291f4ff850STim J. Robbinscauses an immediate return of
4301f4ff850STim J. Robbins.Dv EOF .
4311f4ff850STim J. Robbins.Sh RETURN VALUES
4321f4ff850STim J. RobbinsThese
4331f4ff850STim J. Robbinsfunctions
4341f4ff850STim J. Robbinsreturn
4351f4ff850STim J. Robbinsthe number of input items assigned, which can be fewer than provided
4361f4ff850STim J. Robbinsfor, or even zero, in the event of a matching failure.
4371f4ff850STim J. RobbinsZero
4381f4ff850STim J. Robbinsindicates that, while there was input available,
4391f4ff850STim J. Robbinsno conversions were assigned;
4401f4ff850STim J. Robbinstypically this is due to an invalid input character,
4411f4ff850STim J. Robbinssuch as an alphabetic character for a
4421f4ff850STim J. Robbins.Ql %d
4431f4ff850STim J. Robbinsconversion.
4441f4ff850STim J. RobbinsThe value
4451f4ff850STim J. Robbins.Dv EOF
4461f4ff850STim J. Robbinsis returned if an input failure occurs before any conversion such as an
4471f4ff850STim J. Robbinsend-of-file occurs.
4481f4ff850STim J. RobbinsIf an error or end-of-file occurs after conversion
4491f4ff850STim J. Robbinshas begun,
4501f4ff850STim J. Robbinsthe number of conversions which were successfully completed is returned.
4511f4ff850STim J. Robbins.Sh SEE ALSO
4521f4ff850STim J. Robbins.Xr fgetwc 3 ,
45338b5abadSTim J. Robbins.Xr scanf 3 ,
4541f4ff850STim J. Robbins.Xr wcrtomb 3 ,
4551f4ff850STim J. Robbins.Xr wcstod 3 ,
4561f4ff850STim J. Robbins.Xr wcstol 3 ,
4571f4ff850STim J. Robbins.Xr wcstoul 3 ,
4581f4ff850STim J. Robbins.Xr wprintf 3
4591f4ff850STim J. Robbins.Sh STANDARDS
4601f4ff850STim J. RobbinsThe
4611f4ff850STim J. Robbins.Fn fwscanf ,
4621f4ff850STim J. Robbins.Fn wscanf ,
4631f4ff850STim J. Robbins.Fn swscanf ,
4641f4ff850STim J. Robbins.Fn vfwscanf ,
4651f4ff850STim J. Robbins.Fn vwscanf
4661f4ff850STim J. Robbinsand
4671f4ff850STim J. Robbins.Fn vswscanf
4681f4ff850STim J. Robbinsfunctions
4691f4ff850STim J. Robbinsconform to
4701f4ff850STim J. Robbins.St -isoC-99 .
4711f4ff850STim J. Robbins.Sh BUGS
4721f4ff850STim J. RobbinsIn addition to the bugs documented in
4731f4ff850STim J. Robbins.Xr scanf 3 ,
4741f4ff850STim J. Robbins.Fn wscanf
4751f4ff850STim J. Robbinsdoes not support the
476a9a15f3eSRuslan Ermilov.Dq Li A-Z
4771f4ff850STim J. Robbinsnotation for specifying character ranges with the character
4781f4ff850STim J. Robbinsclass conversion
4791f4ff850STim J. Robbins.Pq Sq Cm %[ .
480