xref: /minix3/lib/libc/stdio/wscanf.3 (revision 2fe8fb192fe7e8720e3e7a77f928da545e872a6a)
1*2fe8fb19SBen Gras.\" $NetBSD: wscanf.3,v 1.3 2010/12/16 17:42:27 wiz Exp $
2*2fe8fb19SBen Gras.\" Copyright (c) 1990, 1991, 1993
3*2fe8fb19SBen Gras.\"	The Regents of the University of California.  All rights reserved.
4*2fe8fb19SBen Gras.\"
5*2fe8fb19SBen Gras.\" This code is derived from software contributed to Berkeley by
6*2fe8fb19SBen Gras.\" Chris Torek and the American National Standards Committee X3,
7*2fe8fb19SBen Gras.\" on Information Processing Systems.
8*2fe8fb19SBen Gras.\"
9*2fe8fb19SBen Gras.\" Redistribution and use in source and binary forms, with or without
10*2fe8fb19SBen Gras.\" modification, are permitted provided that the following conditions
11*2fe8fb19SBen Gras.\" are met:
12*2fe8fb19SBen Gras.\" 1. Redistributions of source code must retain the above copyright
13*2fe8fb19SBen Gras.\"    notice, this list of conditions and the following disclaimer.
14*2fe8fb19SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
15*2fe8fb19SBen Gras.\"    notice, this list of conditions and the following disclaimer in the
16*2fe8fb19SBen Gras.\"    documentation and/or other materials provided with the distribution.
17*2fe8fb19SBen Gras.\" 3. All advertising materials mentioning features or use of this software
18*2fe8fb19SBen Gras.\"    must display the following acknowledgement:
19*2fe8fb19SBen Gras.\"	This product includes software developed by the University of
20*2fe8fb19SBen Gras.\"	California, Berkeley and its contributors.
21*2fe8fb19SBen Gras.\" 4. Neither the name of the University nor the names of its contributors
22*2fe8fb19SBen Gras.\"    may be used to endorse or promote products derived from this software
23*2fe8fb19SBen Gras.\"    without specific prior written permission.
24*2fe8fb19SBen Gras.\"
25*2fe8fb19SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26*2fe8fb19SBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27*2fe8fb19SBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28*2fe8fb19SBen Gras.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29*2fe8fb19SBen Gras.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30*2fe8fb19SBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31*2fe8fb19SBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32*2fe8fb19SBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33*2fe8fb19SBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34*2fe8fb19SBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35*2fe8fb19SBen Gras.\" SUCH DAMAGE.
36*2fe8fb19SBen Gras.\"
37*2fe8fb19SBen Gras.\"     @(#)scanf.3	8.2 (Berkeley) 12/11/93
38*2fe8fb19SBen Gras.\" FreeBSD: src/lib/libc/stdio/scanf.3,v 1.24 2003/06/28 09:03:25 das Exp
39*2fe8fb19SBen Gras.\" $FreeBSD: src/lib/libc/stdio/wscanf.3,v 1.6 2003/07/05 07:47:55 tjr Exp $
40*2fe8fb19SBen Gras.\"
41*2fe8fb19SBen Gras.Dd July 5, 2003
42*2fe8fb19SBen Gras.Dt WSCANF 3
43*2fe8fb19SBen Gras.Os
44*2fe8fb19SBen Gras.Sh NAME
45*2fe8fb19SBen Gras.Nm wscanf ,
46*2fe8fb19SBen Gras.Nm fwscanf ,
47*2fe8fb19SBen Gras.Nm swscanf ,
48*2fe8fb19SBen Gras.Nm vwscanf ,
49*2fe8fb19SBen Gras.Nm vswscanf ,
50*2fe8fb19SBen Gras.Nm vfwscanf
51*2fe8fb19SBen Gras.Nd wide character input format conversion
52*2fe8fb19SBen Gras.Sh LIBRARY
53*2fe8fb19SBen Gras.Lb libc
54*2fe8fb19SBen Gras.Sh SYNOPSIS
55*2fe8fb19SBen Gras.In stdio.h
56*2fe8fb19SBen Gras.In wchar.h
57*2fe8fb19SBen Gras.Ft int
58*2fe8fb19SBen Gras.Fn wscanf "const wchar_t * restrict format" ...
59*2fe8fb19SBen Gras.Ft int
60*2fe8fb19SBen Gras.Fn fwscanf "FILE * restrict stream" "const wchar_t * restrict format" ...
61*2fe8fb19SBen Gras.Ft int
62*2fe8fb19SBen Gras.Fn swscanf "const wchar_t * restrict str" "const wchar_t * restrict format" ...
63*2fe8fb19SBen Gras.In stdarg.h
64*2fe8fb19SBen Gras.Ft int
65*2fe8fb19SBen Gras.Fn vwscanf "const wchar_t * restrict format" "va_list ap"
66*2fe8fb19SBen Gras.Ft int
67*2fe8fb19SBen Gras.Fn vswscanf "const wchar_t * restrict str" "const wchar_t * restrict format" "va_list ap"
68*2fe8fb19SBen Gras.Ft int
69*2fe8fb19SBen Gras.Fn vfwscanf "FILE * restrict stream" "const wchar_t * restrict format" "va_list ap"
70*2fe8fb19SBen Gras.Sh DESCRIPTION
71*2fe8fb19SBen GrasThe
72*2fe8fb19SBen Gras.Fn wscanf
73*2fe8fb19SBen Grasfamily of functions scans input according to a
74*2fe8fb19SBen Gras.Fa format
75*2fe8fb19SBen Grasas described below.
76*2fe8fb19SBen GrasThis format may contain
77*2fe8fb19SBen Gras.Em conversion specifiers ;
78*2fe8fb19SBen Grasthe results from such conversions, if any,
79*2fe8fb19SBen Grasare stored through the
80*2fe8fb19SBen Gras.Em pointer
81*2fe8fb19SBen Grasarguments.
82*2fe8fb19SBen GrasThe
83*2fe8fb19SBen Gras.Fn wscanf
84*2fe8fb19SBen Grasfunction
85*2fe8fb19SBen Grasreads input from the standard input stream
86*2fe8fb19SBen Gras.Dv stdin ,
87*2fe8fb19SBen Gras.Fn fwscanf
88*2fe8fb19SBen Grasreads input from the stream pointer
89*2fe8fb19SBen Gras.Fa stream ,
90*2fe8fb19SBen Grasand
91*2fe8fb19SBen Gras.Fn swscanf
92*2fe8fb19SBen Grasreads its input from the wide-character string pointed to by
93*2fe8fb19SBen Gras.Fa str .
94*2fe8fb19SBen GrasThe
95*2fe8fb19SBen Gras.Fn vfwscanf
96*2fe8fb19SBen Grasfunction
97*2fe8fb19SBen Grasis analogous to
98*2fe8fb19SBen Gras.Xr vfwprintf 3
99*2fe8fb19SBen Grasand reads input from the stream pointer
100*2fe8fb19SBen Gras.Fa stream
101*2fe8fb19SBen Grasusing a variable argument list of pointers (see
102*2fe8fb19SBen Gras.Xr stdarg 3 ) .
103*2fe8fb19SBen GrasThe
104*2fe8fb19SBen Gras.Fn vwscanf
105*2fe8fb19SBen Grasfunction scans a variable argument list from the standard input and
106*2fe8fb19SBen Grasthe
107*2fe8fb19SBen Gras.Fn vswscanf
108*2fe8fb19SBen Grasfunction scans it from a wide-character string;
109*2fe8fb19SBen Grasthese are analogous to
110*2fe8fb19SBen Grasthe
111*2fe8fb19SBen Gras.Fn vwprintf
112*2fe8fb19SBen Grasand
113*2fe8fb19SBen Gras.Fn vswprintf
114*2fe8fb19SBen Grasfunctions respectively.
115*2fe8fb19SBen GrasEach successive
116*2fe8fb19SBen Gras.Em pointer
117*2fe8fb19SBen Grasargument must correspond properly with
118*2fe8fb19SBen Graseach successive conversion specifier
119*2fe8fb19SBen Gras(but see the
120*2fe8fb19SBen Gras.Cm *
121*2fe8fb19SBen Grasconversion below).
122*2fe8fb19SBen GrasAll conversions are introduced by the
123*2fe8fb19SBen Gras.Cm %
124*2fe8fb19SBen Gras(percent sign) character.
125*2fe8fb19SBen GrasThe
126*2fe8fb19SBen Gras.Fa format
127*2fe8fb19SBen Grasstring
128*2fe8fb19SBen Grasmay also contain other characters.
129*2fe8fb19SBen GrasWhite space (such as blanks, tabs, or newlines) in the
130*2fe8fb19SBen Gras.Fa format
131*2fe8fb19SBen Grasstring match any amount of white space, including none, in the input.
132*2fe8fb19SBen GrasEverything else
133*2fe8fb19SBen Grasmatches only itself.
134*2fe8fb19SBen GrasScanning stops
135*2fe8fb19SBen Graswhen an input character does not match such a format character.
136*2fe8fb19SBen GrasScanning also stops
137*2fe8fb19SBen Graswhen an input conversion cannot be made (see below).
138*2fe8fb19SBen Gras.Sh CONVERSIONS
139*2fe8fb19SBen GrasFollowing the
140*2fe8fb19SBen Gras.Cm %
141*2fe8fb19SBen Grascharacter introducing a conversion
142*2fe8fb19SBen Grasthere may be a number of
143*2fe8fb19SBen Gras.Em flag
144*2fe8fb19SBen Grascharacters, as follows:
145*2fe8fb19SBen Gras.Bl -tag -width ".Cm l No (ell)"
146*2fe8fb19SBen Gras.It Cm *
147*2fe8fb19SBen GrasSuppresses assignment.
148*2fe8fb19SBen GrasThe conversion that follows occurs as usual, but no pointer is used;
149*2fe8fb19SBen Grasthe result of the conversion is simply discarded.
150*2fe8fb19SBen Gras.It Cm hh
151*2fe8fb19SBen GrasIndicates that the conversion will be one of
152*2fe8fb19SBen Gras.Cm dioux
153*2fe8fb19SBen Grasor
154*2fe8fb19SBen Gras.Cm n
155*2fe8fb19SBen Grasand the next pointer is a pointer to a
156*2fe8fb19SBen Gras.Vt char
157*2fe8fb19SBen Gras(rather than
158*2fe8fb19SBen Gras.Vt int ) .
159*2fe8fb19SBen Gras.It Cm h
160*2fe8fb19SBen GrasIndicates that the conversion will be one of
161*2fe8fb19SBen Gras.Cm dioux
162*2fe8fb19SBen Grasor
163*2fe8fb19SBen Gras.Cm n
164*2fe8fb19SBen Grasand the next pointer is a pointer to a
165*2fe8fb19SBen Gras.Vt "short int"
166*2fe8fb19SBen Gras(rather than
167*2fe8fb19SBen Gras.Vt int ) .
168*2fe8fb19SBen Gras.It Cm l No (ell)
169*2fe8fb19SBen GrasIndicates that the conversion will be one of
170*2fe8fb19SBen Gras.Cm dioux
171*2fe8fb19SBen Grasor
172*2fe8fb19SBen Gras.Cm n
173*2fe8fb19SBen Grasand the next pointer is a pointer to a
174*2fe8fb19SBen Gras.Vt "long int"
175*2fe8fb19SBen Gras(rather than
176*2fe8fb19SBen Gras.Vt int ) ,
177*2fe8fb19SBen Grasthat the conversion will be one of
178*2fe8fb19SBen Gras.Cm a , e , f ,
179*2fe8fb19SBen Grasor
180*2fe8fb19SBen Gras.Cm g
181*2fe8fb19SBen Grasand the next pointer is a pointer to
182*2fe8fb19SBen Gras.Vt double
183*2fe8fb19SBen Gras(rather than
184*2fe8fb19SBen Gras.Vt float ) ,
185*2fe8fb19SBen Grasor that the conversion will be one of
186*2fe8fb19SBen Gras.Cm c
187*2fe8fb19SBen Grasor
188*2fe8fb19SBen Gras.Cm s
189*2fe8fb19SBen Grasand the next pointer is a pointer to an array of
190*2fe8fb19SBen Gras.Vt wchar_t
191*2fe8fb19SBen Gras(rather than
192*2fe8fb19SBen Gras.Vt char ) .
193*2fe8fb19SBen Gras.It Cm ll No (ell ell)
194*2fe8fb19SBen GrasIndicates that the conversion will be one of
195*2fe8fb19SBen Gras.Cm dioux
196*2fe8fb19SBen Grasor
197*2fe8fb19SBen Gras.Cm n
198*2fe8fb19SBen Grasand the next pointer is a pointer to a
199*2fe8fb19SBen Gras.Vt "long long int"
200*2fe8fb19SBen Gras(rather than
201*2fe8fb19SBen Gras.Vt int ) .
202*2fe8fb19SBen Gras.It Cm L
203*2fe8fb19SBen GrasIndicates that the conversion will be one of
204*2fe8fb19SBen Gras.Cm a , e , f ,
205*2fe8fb19SBen Grasor
206*2fe8fb19SBen Gras.Cm g
207*2fe8fb19SBen Grasand the next pointer is a pointer to
208*2fe8fb19SBen Gras.Vt "long double" .
209*2fe8fb19SBen Gras.It Cm j
210*2fe8fb19SBen GrasIndicates that the conversion will be one of
211*2fe8fb19SBen Gras.Cm dioux
212*2fe8fb19SBen Grasor
213*2fe8fb19SBen Gras.Cm n
214*2fe8fb19SBen Grasand the next pointer is a pointer to a
215*2fe8fb19SBen Gras.Vt intmax_t
216*2fe8fb19SBen Gras(rather than
217*2fe8fb19SBen Gras.Vt int ) .
218*2fe8fb19SBen Gras.It Cm t
219*2fe8fb19SBen GrasIndicates that the conversion will be one of
220*2fe8fb19SBen Gras.Cm dioux
221*2fe8fb19SBen Grasor
222*2fe8fb19SBen Gras.Cm n
223*2fe8fb19SBen Grasand the next pointer is a pointer to a
224*2fe8fb19SBen Gras.Vt ptrdiff_t
225*2fe8fb19SBen Gras(rather than
226*2fe8fb19SBen Gras.Vt int ) .
227*2fe8fb19SBen Gras.It Cm z
228*2fe8fb19SBen GrasIndicates that the conversion will be one of
229*2fe8fb19SBen Gras.Cm dioux
230*2fe8fb19SBen Grasor
231*2fe8fb19SBen Gras.Cm n
232*2fe8fb19SBen Grasand the next pointer is a pointer to a
233*2fe8fb19SBen Gras.Vt size_t
234*2fe8fb19SBen Gras(rather than
235*2fe8fb19SBen Gras.Vt int ) .
236*2fe8fb19SBen Gras.It Cm q
237*2fe8fb19SBen Gras(deprecated.)
238*2fe8fb19SBen GrasIndicates that the conversion will be one of
239*2fe8fb19SBen Gras.Cm dioux
240*2fe8fb19SBen Grasor
241*2fe8fb19SBen Gras.Cm n
242*2fe8fb19SBen Grasand the next pointer is a pointer to a
243*2fe8fb19SBen Gras.Vt "long long int"
244*2fe8fb19SBen Gras(rather than
245*2fe8fb19SBen Gras.Vt int ) .
246*2fe8fb19SBen Gras.El
247*2fe8fb19SBen Gras.Pp
248*2fe8fb19SBen GrasIn addition to these flags,
249*2fe8fb19SBen Grasthere may be an optional maximum field width,
250*2fe8fb19SBen Grasexpressed as a decimal integer,
251*2fe8fb19SBen Grasbetween the
252*2fe8fb19SBen Gras.Cm %
253*2fe8fb19SBen Grasand the conversion.
254*2fe8fb19SBen GrasIf no width is given,
255*2fe8fb19SBen Grasa default of
256*2fe8fb19SBen Gras.Dq infinity
257*2fe8fb19SBen Grasis used (with one exception, below);
258*2fe8fb19SBen Grasotherwise at most this many characters are scanned
259*2fe8fb19SBen Grasin processing the conversion.
260*2fe8fb19SBen GrasBefore conversion begins,
261*2fe8fb19SBen Grasmost conversions skip white space;
262*2fe8fb19SBen Grasthis white space is not counted against the field width.
263*2fe8fb19SBen Gras.Pp
264*2fe8fb19SBen GrasThe following conversions are available:
265*2fe8fb19SBen Gras.Bl -tag -width XXXX
266*2fe8fb19SBen Gras.It Cm %
267*2fe8fb19SBen GrasMatches a literal
268*2fe8fb19SBen Gras.Ql % .
269*2fe8fb19SBen GrasThat is,
270*2fe8fb19SBen Gras.Dq Li %%
271*2fe8fb19SBen Grasin the format string
272*2fe8fb19SBen Grasmatches a single input
273*2fe8fb19SBen Gras.Ql %
274*2fe8fb19SBen Grascharacter.
275*2fe8fb19SBen GrasNo conversion is done, and assignment does not occur.
276*2fe8fb19SBen Gras.It Cm d
277*2fe8fb19SBen GrasMatches an optionally signed decimal integer;
278*2fe8fb19SBen Grasthe next pointer must be a pointer to
279*2fe8fb19SBen Gras.Vt int .
280*2fe8fb19SBen Gras.It Cm i
281*2fe8fb19SBen GrasMatches an optionally signed integer;
282*2fe8fb19SBen Grasthe next pointer must be a pointer to
283*2fe8fb19SBen Gras.Vt int .
284*2fe8fb19SBen GrasThe integer is read in base 16 if it begins
285*2fe8fb19SBen Graswith
286*2fe8fb19SBen Gras.Ql 0x
287*2fe8fb19SBen Grasor
288*2fe8fb19SBen Gras.Ql 0X ,
289*2fe8fb19SBen Grasin base 8 if it begins with
290*2fe8fb19SBen Gras.Ql 0 ,
291*2fe8fb19SBen Grasand in base 10 otherwise.
292*2fe8fb19SBen GrasOnly characters that correspond to the base are used.
293*2fe8fb19SBen Gras.It Cm o
294*2fe8fb19SBen GrasMatches an octal integer;
295*2fe8fb19SBen Grasthe next pointer must be a pointer to
296*2fe8fb19SBen Gras.Vt "unsigned int" .
297*2fe8fb19SBen Gras.It Cm u
298*2fe8fb19SBen GrasMatches an optionally signed decimal integer;
299*2fe8fb19SBen Grasthe next pointer must be a pointer to
300*2fe8fb19SBen Gras.Vt "unsigned int" .
301*2fe8fb19SBen Gras.It Cm x , X
302*2fe8fb19SBen GrasMatches an optionally signed hexadecimal integer;
303*2fe8fb19SBen Grasthe next pointer must be a pointer to
304*2fe8fb19SBen Gras.Vt "unsigned int" .
305*2fe8fb19SBen Gras.It Cm a , A , e , E , f , F , g , G
306*2fe8fb19SBen GrasMatches a floating-point number in the style of
307*2fe8fb19SBen Gras.Xr wcstod 3 .
308*2fe8fb19SBen GrasThe next pointer must be a pointer to
309*2fe8fb19SBen Gras.Vt float
310*2fe8fb19SBen Gras(unless
311*2fe8fb19SBen Gras.Cm l
312*2fe8fb19SBen Grasor
313*2fe8fb19SBen Gras.Cm L
314*2fe8fb19SBen Grasis specified.)
315*2fe8fb19SBen Gras.It Cm s
316*2fe8fb19SBen GrasMatches a sequence of non-white-space wide characters;
317*2fe8fb19SBen Grasthe next pointer must be a pointer to
318*2fe8fb19SBen Gras.Vt char ,
319*2fe8fb19SBen Grasand the array must be large enough to accept the multibyte representation
320*2fe8fb19SBen Grasof all the sequence and the
321*2fe8fb19SBen Grasterminating
322*2fe8fb19SBen Gras.Dv NUL
323*2fe8fb19SBen Grascharacter.
324*2fe8fb19SBen GrasThe input string stops at white space
325*2fe8fb19SBen Grasor at the maximum field width, whichever occurs first.
326*2fe8fb19SBen Gras.Pp
327*2fe8fb19SBen GrasIf an
328*2fe8fb19SBen Gras.Cm l
329*2fe8fb19SBen Grasqualifier is present, the next pointer must be a pointer to
330*2fe8fb19SBen Gras.Vt wchar_t ,
331*2fe8fb19SBen Grasinto which the input will be placed.
332*2fe8fb19SBen Gras.It Cm S
333*2fe8fb19SBen GrasThe same as
334*2fe8fb19SBen Gras.Cm ls .
335*2fe8fb19SBen Gras.It Cm c
336*2fe8fb19SBen GrasMatches a sequence of
337*2fe8fb19SBen Gras.Em width
338*2fe8fb19SBen Grascount
339*2fe8fb19SBen Graswide characters (default 1);
340*2fe8fb19SBen Grasthe next pointer must be a pointer to
341*2fe8fb19SBen Gras.Vt char ,
342*2fe8fb19SBen Grasand there must be enough room for the multibyte representation
343*2fe8fb19SBen Grasof all the characters
344*2fe8fb19SBen Gras(no terminating
345*2fe8fb19SBen Gras.Dv NUL
346*2fe8fb19SBen Grasis added).
347*2fe8fb19SBen GrasThe usual skip of leading white space is suppressed.
348*2fe8fb19SBen GrasTo skip white space first, use an explicit space in the format.
349*2fe8fb19SBen Gras.Pp
350*2fe8fb19SBen GrasIf an
351*2fe8fb19SBen Gras.Cm l
352*2fe8fb19SBen Grasqualifier is present, the next pointer must be a pointer to
353*2fe8fb19SBen Gras.Vt wchar_t ,
354*2fe8fb19SBen Grasinto which the input will be placed.
355*2fe8fb19SBen Gras.It Cm C
356*2fe8fb19SBen GrasThe same as
357*2fe8fb19SBen Gras.Cm lc .
358*2fe8fb19SBen Gras.It Cm \&[
359*2fe8fb19SBen GrasMatches a nonempty sequence of characters from the specified set
360*2fe8fb19SBen Grasof accepted characters;
361*2fe8fb19SBen Grasthe next pointer must be a pointer to
362*2fe8fb19SBen Gras.Vt char ,
363*2fe8fb19SBen Grasand there must be enough room for the multibyte representation of
364*2fe8fb19SBen Grasall the characters in the string,
365*2fe8fb19SBen Grasplus a terminating
366*2fe8fb19SBen Gras.Dv NUL
367*2fe8fb19SBen Grascharacter.
368*2fe8fb19SBen GrasThe usual skip of leading white space is suppressed.
369*2fe8fb19SBen GrasThe string is to be made up of characters in
370*2fe8fb19SBen Gras(or not in)
371*2fe8fb19SBen Grasa particular set;
372*2fe8fb19SBen Grasthe set is defined by the characters between the open bracket
373*2fe8fb19SBen Gras.Cm \&[
374*2fe8fb19SBen Grascharacter
375*2fe8fb19SBen Grasand a close bracket
376*2fe8fb19SBen Gras.Cm \&]
377*2fe8fb19SBen Grascharacter.
378*2fe8fb19SBen GrasThe set
379*2fe8fb19SBen Gras.Em excludes
380*2fe8fb19SBen Grasthose characters
381*2fe8fb19SBen Grasif the first character after the open bracket is a circumflex
382*2fe8fb19SBen Gras.Cm ^ .
383*2fe8fb19SBen GrasTo include a close bracket in the set,
384*2fe8fb19SBen Grasmake it the first character after the open bracket
385*2fe8fb19SBen Grasor the circumflex;
386*2fe8fb19SBen Grasany other position will end the set.
387*2fe8fb19SBen GrasTo include a hyphen in the set,
388*2fe8fb19SBen Grasmake it the last character before the final close bracket;
389*2fe8fb19SBen Grassome implementations of
390*2fe8fb19SBen Gras.Fn wscanf
391*2fe8fb19SBen Grasuse
392*2fe8fb19SBen Gras.Dq Li A-Z
393*2fe8fb19SBen Grasto represent the range of characters between
394*2fe8fb19SBen Gras.Ql A
395*2fe8fb19SBen Grasand
396*2fe8fb19SBen Gras.Ql Z .
397*2fe8fb19SBen GrasThe string ends with the appearance of a character not in the
398*2fe8fb19SBen Gras(or, with a circumflex, in) set
399*2fe8fb19SBen Grasor when the field width runs out.
400*2fe8fb19SBen Gras.Pp
401*2fe8fb19SBen GrasIf an
402*2fe8fb19SBen Gras.Cm l
403*2fe8fb19SBen Grasqualifier is present, the next pointer must be a pointer to
404*2fe8fb19SBen Gras.Vt wchar_t ,
405*2fe8fb19SBen Grasinto which the input will be placed.
406*2fe8fb19SBen Gras.It Cm p
407*2fe8fb19SBen GrasMatches a pointer value (as printed by
408*2fe8fb19SBen Gras.Ql %p
409*2fe8fb19SBen Grasin
410*2fe8fb19SBen Gras.Xr wprintf 3 ) ;
411*2fe8fb19SBen Grasthe next pointer must be a pointer to
412*2fe8fb19SBen Gras.Vt void .
413*2fe8fb19SBen Gras.It Cm n
414*2fe8fb19SBen GrasNothing is expected;
415*2fe8fb19SBen Grasinstead, the number of characters consumed thus far from the input
416*2fe8fb19SBen Grasis stored through the next pointer,
417*2fe8fb19SBen Graswhich must be a pointer to
418*2fe8fb19SBen Gras.Vt int .
419*2fe8fb19SBen GrasThis is
420*2fe8fb19SBen Gras.Em not
421*2fe8fb19SBen Grasa conversion, although it can be suppressed with the
422*2fe8fb19SBen Gras.Cm *
423*2fe8fb19SBen Grasflag.
424*2fe8fb19SBen Gras.El
425*2fe8fb19SBen Gras.Pp
426*2fe8fb19SBen GrasThe decimal point
427*2fe8fb19SBen Grascharacter is defined in the program's locale (category
428*2fe8fb19SBen Gras.Dv LC_NUMERIC ) .
429*2fe8fb19SBen Gras.Pp
430*2fe8fb19SBen GrasFor backwards compatibility, a
431*2fe8fb19SBen Gras.Dq conversion
432*2fe8fb19SBen Grasof
433*2fe8fb19SBen Gras.Ql %\e0
434*2fe8fb19SBen Grascauses an immediate return of
435*2fe8fb19SBen Gras.Dv EOF .
436*2fe8fb19SBen Gras.Sh RETURN VALUES
437*2fe8fb19SBen GrasThese
438*2fe8fb19SBen Grasfunctions
439*2fe8fb19SBen Grasreturn
440*2fe8fb19SBen Grasthe number of input items assigned, which can be fewer than provided
441*2fe8fb19SBen Grasfor, or even zero, in the event of a matching failure.
442*2fe8fb19SBen GrasZero
443*2fe8fb19SBen Grasindicates that, while there was input available,
444*2fe8fb19SBen Grasno conversions were assigned;
445*2fe8fb19SBen Grastypically this is due to an invalid input character,
446*2fe8fb19SBen Grassuch as an alphabetic character for a
447*2fe8fb19SBen Gras.Ql %d
448*2fe8fb19SBen Grasconversion.
449*2fe8fb19SBen GrasThe value
450*2fe8fb19SBen Gras.Dv EOF
451*2fe8fb19SBen Grasis returned if an input failure occurs before any conversion such as an
452*2fe8fb19SBen Grasend-of-file occurs.
453*2fe8fb19SBen GrasIf an error or end-of-file occurs after conversion
454*2fe8fb19SBen Grashas begun,
455*2fe8fb19SBen Grasthe number of conversions which were successfully completed is returned.
456*2fe8fb19SBen Gras.Sh SEE ALSO
457*2fe8fb19SBen Gras.Xr fgetwc 3 ,
458*2fe8fb19SBen Gras.Xr scanf 3 ,
459*2fe8fb19SBen Gras.Xr wcrtomb 3 ,
460*2fe8fb19SBen Gras.Xr wcstod 3 ,
461*2fe8fb19SBen Gras.Xr wcstol 3 ,
462*2fe8fb19SBen Gras.Xr wcstoul 3 ,
463*2fe8fb19SBen Gras.Xr wprintf 3
464*2fe8fb19SBen Gras.Sh STANDARDS
465*2fe8fb19SBen GrasThe
466*2fe8fb19SBen Gras.Fn fwscanf ,
467*2fe8fb19SBen Gras.Fn wscanf ,
468*2fe8fb19SBen Gras.Fn swscanf ,
469*2fe8fb19SBen Gras.Fn vfwscanf ,
470*2fe8fb19SBen Gras.Fn vwscanf
471*2fe8fb19SBen Grasand
472*2fe8fb19SBen Gras.Fn vswscanf
473*2fe8fb19SBen Grasfunctions
474*2fe8fb19SBen Grasconform to
475*2fe8fb19SBen Gras.St -isoC-99 .
476*2fe8fb19SBen Gras.Sh BUGS
477*2fe8fb19SBen GrasIn addition to the bugs documented in
478*2fe8fb19SBen Gras.Xr scanf 3 ,
479*2fe8fb19SBen Gras.Fn wscanf
480*2fe8fb19SBen Grasdoes not support the
481*2fe8fb19SBen Gras.Dq Li A-Z
482*2fe8fb19SBen Grasnotation for specifying character ranges with the character
483*2fe8fb19SBen Grasclass conversion
484*2fe8fb19SBen Gras.Pq Sq Cm %[ .
485