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