]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" This code is derived from software contributed to Berkeley by | |
5 | .\" Chris Torek and the American National Standards Committee X3, | |
6 | .\" on Information Processing Systems. | |
7 | .\" | |
a9cd9cb7 | 8 | .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) |
fea681da MK |
9 | .\" Redistribution and use in source and binary forms, with or without |
10 | .\" modification, are permitted provided that the following conditions | |
11 | .\" are met: | |
12 | .\" 1. Redistributions of source code must retain the above copyright | |
13 | .\" notice, this list of conditions and the following disclaimer. | |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
15 | .\" notice, this list of conditions and the following disclaimer in the | |
16 | .\" documentation and/or other materials provided with the distribution. | |
17 | .\" 3. All advertising materials mentioning features or use of this software | |
18 | .\" must display the following acknowledgement: | |
19 | .\" This product includes software developed by the University of | |
20 | .\" California, Berkeley and its contributors. | |
21 | .\" 4. Neither the name of the University nor the names of its contributors | |
22 | .\" may be used to endorse or promote products derived from this software | |
23 | .\" without specific prior written permission. | |
24 | .\" | |
25 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
26 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
27 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
28 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
29 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
30 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
31 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
32 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
33 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
34 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
35 | .\" SUCH DAMAGE. | |
8c9302dc | 36 | .\" %%%LICENSE_END |
fea681da MK |
37 | .\" |
38 | .\" @(#)scanf.3 6.14 (Berkeley) 1/8/93 | |
39 | .\" | |
40 | .\" Converted for Linux, Mon Nov 29 15:22:01 1993, faith@cs.unc.edu | |
c13182ef | 41 | .\" modified to resemble the GNU libio setup used in the Linux libc |
fea681da MK |
42 | .\" used in versions 4.x (x>4) and 5 Helmut.Geyer@iwr.uni-heidelberg.de |
43 | .\" Modified, aeb, 970121 | |
c13182ef MK |
44 | .\" 2005-07-14, mtk, added description of %n$ form; various text |
45 | .\" incorporated from the GNU C library documentation ((C) The | |
991910a4 | 46 | .\" Free Software Foundation); other parts substantially rewritten. |
fea681da | 47 | .\" |
7042009b | 48 | .\" 2008-06-23, mtk |
194f4ccb MK |
49 | .\" Add ERRORS section. |
50 | .\" Document the 'a' and 'm' modifiers for dynamic string allocation. | |
7deb3c8b | 51 | .\" |
c73595c2 | 52 | .TH SCANF 3 2015-04-19 "GNU" "Linux Programmer's Manual" |
fea681da MK |
53 | .SH NAME |
54 | scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf \- input format conversion | |
55 | .SH SYNOPSIS | |
56 | .nf | |
57 | .B #include <stdio.h> | |
a45ebabf MK |
58 | |
59 | .BI "int scanf(const char *" format ", ...);" | |
60 | .BI "int fscanf(FILE *" stream ", const char *" format ", ...);" | |
61 | .BI "int sscanf(const char *" str ", const char *" format ", ...);" | |
fea681da MK |
62 | .sp |
63 | .B #include <stdarg.h> | |
a45ebabf | 64 | |
fea681da | 65 | .BI "int vscanf(const char *" format ", va_list " ap ); |
fea681da | 66 | .BI "int vsscanf(const char *" str ", const char *" format ", va_list " ap ); |
fea681da | 67 | .BI "int vfscanf(FILE *" stream ", const char *" format ", va_list " ap ); |
cc4615cc MK |
68 | .fi |
69 | .sp | |
70 | .in -4n | |
71 | Feature Test Macro Requirements for glibc (see | |
72 | .BR feature_test_macros (7)): | |
73 | .in | |
a1d525f2 | 74 | .ad l |
cc4615cc MK |
75 | .sp |
76 | .BR vscanf (), | |
77 | .BR vsscanf (), | |
78 | .BR vfscanf (): | |
a1d525f2 | 79 | .RS 4 |
3aa541c8 MK |
80 | _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE || |
81 | _POSIX_C_SOURCE\ >=\ 200112L; | |
a1d525f2 MK |
82 | .br |
83 | or | |
cc4615cc | 84 | .I "cc -std=c99" |
a1d525f2 MK |
85 | .ad |
86 | .RE | |
fea681da MK |
87 | .SH DESCRIPTION |
88 | The | |
e511ffb6 | 89 | .BR scanf () |
991910a4 | 90 | family of functions scans input according to |
fea681da | 91 | .I format |
c13182ef MK |
92 | as described below. |
93 | This format may contain | |
991910a4 MK |
94 | .IR "conversion specifications" ; |
95 | the results from such conversions, if any, | |
96 | are stored in the locations pointed to by the | |
c13182ef | 97 | .I pointer |
991910a4 MK |
98 | arguments that follow |
99 | .IR format . | |
c13182ef | 100 | Each |
fea681da | 101 | .I pointer |
c13182ef | 102 | argument must be of a type that is appropriate for the value returned |
991910a4 MK |
103 | by the corresponding conversion specification. |
104 | ||
105 | If the number of conversion specifications in | |
106 | .I format | |
107 | exceeds the number of | |
108 | .I pointer | |
109 | arguments, the results are undefined. | |
110 | If the number of | |
111 | .I pointer | |
112 | arguments exceeds the number of conversion specifications, then the excess | |
113 | .I pointer | |
114 | arguments are evaluated, but are otherwise ignored. | |
115 | ||
116 | The | |
e511ffb6 | 117 | .BR scanf () |
fea681da MK |
118 | function reads input from the standard input stream |
119 | .IR stdin , | |
e511ffb6 | 120 | .BR fscanf () |
fea681da MK |
121 | reads input from the stream pointer |
122 | .IR stream , | |
123 | and | |
e511ffb6 | 124 | .BR sscanf () |
fea681da MK |
125 | reads its input from the character string pointed to by |
126 | .IR str . | |
127 | .PP | |
128 | The | |
e511ffb6 | 129 | .BR vfscanf () |
fea681da MK |
130 | function is analogous to |
131 | .BR vfprintf (3) | |
132 | and reads input from the stream pointer | |
133 | .I stream | |
134 | using a variable argument list of pointers (see | |
135 | .BR stdarg (3). | |
136 | The | |
e511ffb6 | 137 | .BR vscanf () |
fea681da | 138 | function scans a variable argument list from the standard input and the |
e511ffb6 | 139 | .BR vsscanf () |
fea681da | 140 | function scans it from a string; these are analogous to the |
fb186734 | 141 | .BR vprintf (3) |
fea681da | 142 | and |
fb186734 | 143 | .BR vsprintf (3) |
fea681da MK |
144 | functions respectively. |
145 | .PP | |
991910a4 MK |
146 | The |
147 | .I format | |
c13182ef | 148 | string consists of a sequence of |
0daa9e92 | 149 | .I directives |
991910a4 MK |
150 | which describe how to process the sequence of input characters. |
151 | If processing of a directive fails, no further input is read, and | |
e511ffb6 | 152 | .BR scanf () |
991910a4 MK |
153 | returns. |
154 | A "failure" can be either of the following: | |
155 | .IR "input failure" , | |
156 | meaning that input characters were unavailable, or | |
157 | .IR "matching failure" , | |
158 | meaning that the input was inappropriate (see below). | |
159 | ||
160 | A directive is one of the following: | |
161 | .TP | |
162 | \(bu | |
0967c11f | 163 | A sequence of white-space characters (space, tab, newline, etc.; see |
991910a4 MK |
164 | .BR isspace (3)). |
165 | This directive matches any amount of white space, | |
166 | including none, in the input. | |
167 | .TP | |
168 | \(bu | |
333a424b | 169 | An ordinary character (i.e., one other than white space or \(aq%\(aq). |
991910a4 MK |
170 | This character must exactly match the next character of input. |
171 | .TP | |
172 | \(bu | |
333a424b MK |
173 | A conversion specification, |
174 | which commences with a \(aq%\(aq (percent) character. | |
c13182ef | 175 | A sequence of characters from the input is converted according to |
991910a4 | 176 | this specification, and the result is placed in the corresponding |
fea681da | 177 | .I pointer |
991910a4 | 178 | argument. |
8666f209 | 179 | If the next item of input does not match the conversion specification, |
5503c85e | 180 | the conversion fails\(emthis is a |
991910a4 MK |
181 | .IR "matching failure" . |
182 | .PP | |
183 | Each | |
c13182ef | 184 | .I conversion specification |
991910a4 | 185 | in |
c13182ef | 186 | .I format |
333a424b | 187 | begins with either the character \(aq%\(aq or the character sequence |
991910a4 | 188 | "\fB%\fP\fIn\fP\fB$\fP" |
faa42a0a | 189 | (see below for the distinction) followed by: |
991910a4 MK |
190 | .TP |
191 | \(bu | |
333a424b | 192 | An optional \(aq*\(aq assignment-suppression character: |
e511ffb6 | 193 | .BR scanf () |
991910a4 MK |
194 | reads input as directed by the conversion specification, |
195 | but discards the input. | |
196 | No corresponding | |
197 | .I pointer | |
198 | argument is required, and this specification is not | |
199 | included in the count of successful assignments returned by | |
e511ffb6 | 200 | .BR scanf (). |
991910a4 MK |
201 | .TP |
202 | \(bu | |
71380e9e | 203 | An optional \(aqm\(aq character. |
558fe164 MK |
204 | This is used with string conversions |
205 | .RI ( %s , | |
206 | .IR %c , | |
207 | .IR %[ ), | |
208 | and relieves the caller of the | |
991910a4 | 209 | need to allocate a corresponding buffer to hold the input: instead, |
e511ffb6 | 210 | .BR scanf () |
c13182ef | 211 | allocates a buffer of sufficient size, |
991910a4 MK |
212 | and assigns the address of this buffer to the corresponding |
213 | .I pointer | |
214 | argument, which should be a pointer to a | |
5049da5b | 215 | .I "char\ *" |
d9bfdb9c | 216 | variable (this variable does not need to be initialized before the call). |
991910a4 MK |
217 | The caller should subsequently |
218 | .BR free (3) | |
219 | this buffer when it is no longer required. | |
991910a4 MK |
220 | .TP |
221 | \(bu | |
222 | An optional decimal integer which specifies the | |
223 | .IR "maximum field width" . | |
c13182ef | 224 | Reading of characters stops either when this maximum is reached or |
24b74457 | 225 | when a nonmatching character is found, whichever happens first. |
f9d17bc4 | 226 | Most conversions discard initial white space characters (the exceptions |
c13182ef | 227 | are noted below), |
5fab2e7c | 228 | and these discarded characters don't count toward the maximum field width. |
71d9e7ae | 229 | String input conversions store a terminating null byte (\(aq\\0\(aq) |
c13182ef | 230 | to mark the end of the input; |
991910a4 MK |
231 | the maximum field width does not include this terminator. |
232 | .TP | |
233 | \(bu | |
c13182ef MK |
234 | An optional |
235 | .IR "type modifier character" . | |
991910a4 MK |
236 | For example, the |
237 | .B l | |
c13182ef | 238 | type modifier is used with integer conversions such as |
5adafd6d | 239 | .B %d |
991910a4 MK |
240 | to specify that the corresponding |
241 | .I pointer | |
c13182ef | 242 | argument refers to a |
991910a4 | 243 | .I "long int" |
c13182ef | 244 | rather than a pointer to an |
991910a4 MK |
245 | .IR int . |
246 | .TP | |
247 | \(bu | |
c13182ef | 248 | A |
991910a4 MK |
249 | .I "conversion specifier" |
250 | that specifies the type of input conversion to be performed. | |
c13182ef | 251 | .PP |
991910a4 | 252 | The conversion specifications in |
fea681da | 253 | .I format |
333a424b | 254 | are of two forms, either beginning with \(aq%\(aq or beginning with |
991910a4 | 255 | "\fB%\fP\fIn\fP\fB$\fP". |
c13182ef | 256 | The two forms should not be mixed in the same |
fea681da | 257 | .I format |
c13182ef | 258 | string, except that a string containing |
991910a4 MK |
259 | "\fB%\fP\fIn\fP\fB$\fP" |
260 | specifications can include | |
5adafd6d | 261 | .B %% |
c13182ef | 262 | and |
5adafd6d | 263 | .BR %* . |
991910a4 MK |
264 | If |
265 | .I format | |
333a424b | 266 | contains \(aq%\(aq |
830b5761 | 267 | specifications, then these correspond in order with successive |
991910a4 MK |
268 | .I pointer |
269 | arguments. | |
270 | In the | |
271 | "\fB%\fP\fIn\fP\fB$\fP" | |
68e1685c | 272 | form (which is specified in POSIX.1-2001, but not C99), |
991910a4 | 273 | .I n |
c13182ef | 274 | is a decimal integer that specifies that the converted input should |
991910a4 MK |
275 | be placed in the location referred to by the |
276 | .IR n -th | |
277 | .I pointer | |
278 | argument following | |
279 | .IR format . | |
8af1ba10 | 280 | .SS Conversions |
991910a4 | 281 | The following |
0daa9e92 | 282 | .I "type modifier characters" |
991910a4 | 283 | can appear in a conversion specification: |
fea681da MK |
284 | .TP |
285 | .B h | |
286 | Indicates that the conversion will be one of | |
c59f8dfe | 287 | \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, \fBx\fP, \fBX\fP, or \fBn\fP |
fea681da | 288 | and the next pointer is a pointer to a |
991910a4 MK |
289 | .I short int |
290 | or | |
291 | .I unsigned short int | |
fea681da MK |
292 | (rather than |
293 | .IR int ). | |
294 | .TP | |
991910a4 MK |
295 | .B hh |
296 | As for | |
297 | .BR h , | |
298 | but the next pointer is a pointer to a | |
299 | .I signed char | |
300 | or | |
301 | .IR "unsigned char" . | |
302 | .TP | |
303 | .B j | |
304 | As for | |
305 | .BR h , | |
3c5e62b6 | 306 | but the next pointer is a pointer to an |
991910a4 | 307 | .I intmax_t |
3c5e62b6 | 308 | or a |
991910a4 MK |
309 | .IR uintmax_t . |
310 | This modifier was introduced in C99. | |
311 | .TP | |
fea681da MK |
312 | .B l |
313 | Indicates either that the conversion will be one of | |
c59f8dfe | 314 | \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, \fBx\fP, \fBX\fP, or \fBn\fP |
fea681da | 315 | and the next pointer is a pointer to a |
991910a4 MK |
316 | .I long int |
317 | or | |
318 | .I unsigned long int | |
fea681da MK |
319 | (rather than |
320 | .IR int ), | |
321 | or that the conversion will be one of | |
c59f8dfe | 322 | \fBe\fP, \fBf\fP, or \fBg\fP |
fea681da MK |
323 | and the next pointer is a pointer to |
324 | .I double | |
325 | (rather than | |
326 | .IR float ). | |
c13182ef | 327 | Specifying two |
fea681da | 328 | .B l |
991910a4 MK |
329 | characters is equivalent to |
330 | .BR L . | |
331 | If used with | |
5adafd6d | 332 | .B %c |
c13182ef | 333 | or |
53df4e93 | 334 | .BR %s , |
c13182ef | 335 | the corresponding parameter is considered |
d0f17b57 | 336 | as a pointer to a wide character or wide-character string respectively. |
991910a4 | 337 | .\" This use of l was introduced in Amendment 1 to ISO C90. |
fea681da MK |
338 | .TP |
339 | .B L | |
340 | Indicates that the conversion will be either | |
c59f8dfe | 341 | \fBe\fP, \fBf\fP, or \fBg\fP |
fea681da | 342 | and the next pointer is a pointer to |
0daa9e92 | 343 | .I "long double" |
c13182ef | 344 | or the conversion will be |
c59f8dfe | 345 | \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, or \fBx\fP |
fea681da MK |
346 | and the next pointer is a pointer to |
347 | .IR "long long" . | |
c13182ef | 348 | .\" MTK, Jul 05: The following is no longer true for modern |
991910a4 | 349 | .\" ANSI C (i.e., C99): |
c13182ef MK |
350 | .\" (Note that long long is not an |
351 | .\" ANSI C | |
991910a4 MK |
352 | .\" type. Any program using this will not be portable to all |
353 | .\" architectures). | |
fea681da MK |
354 | .TP |
355 | .B q | |
c13182ef MK |
356 | equivalent to |
357 | .BR L . | |
991910a4 MK |
358 | This specifier does not exist in ANSI C. |
359 | .TP | |
360 | .B t | |
361 | As for | |
362 | .BR h , | |
363 | but the next pointer is a pointer to a | |
364 | .IR ptrdiff_t . | |
365 | This modifier was introduced in C99. | |
366 | .TP | |
367 | .B z | |
368 | As for | |
369 | .BR h , | |
370 | but the next pointer is a pointer to a | |
371 | .IR size_t . | |
372 | This modifier was introduced in C99. | |
fea681da | 373 | .PP |
c13182ef | 374 | The following |
991910a4 MK |
375 | .I "conversion specifiers" |
376 | are available: | |
fea681da MK |
377 | .TP |
378 | .B % | |
333a424b | 379 | Matches a literal \(aq%\(aq. |
c13182ef | 380 | That is, |
5adafd6d | 381 | .B %\&% |
991910a4 | 382 | in the format string matches a |
333a424b | 383 | single input \(aq%\(aq character. |
f9d17bc4 MK |
384 | No conversion is done (but initial white space characters are discarded), |
385 | and assignment does not occur. | |
fea681da MK |
386 | .TP |
387 | .B d | |
388 | Matches an optionally signed decimal integer; | |
389 | the next pointer must be a pointer to | |
390 | .IR int . | |
391 | .TP | |
392 | .B D | |
393 | Equivalent to | |
991910a4 | 394 | .IR ld ; |
5fab2e7c | 395 | this exists only for backward compatibility. |
c13182ef MK |
396 | (Note: thus only in libc4. |
397 | In libc5 and glibc the | |
5adafd6d | 398 | .B %D |
991910a4 | 399 | is silently ignored, causing old programs to fail mysteriously.) |
fea681da MK |
400 | .TP |
401 | .B i | |
402 | Matches an optionally signed integer; the next pointer must be a pointer to | |
403 | .IR int . | |
c13182ef | 404 | The integer is read in base 16 if it begins with |
991910a4 | 405 | .I 0x |
c13182ef MK |
406 | or |
407 | .IR 0X , | |
408 | in base 8 if it begins with | |
409 | .IR 0 , | |
991910a4 MK |
410 | and in base 10 otherwise. |
411 | Only characters that correspond to the base are used. | |
fea681da MK |
412 | .TP |
413 | .B o | |
414 | Matches an unsigned octal integer; the next pointer must be a pointer to | |
415 | .IR "unsigned int" . | |
416 | .TP | |
417 | .B u | |
418 | Matches an unsigned decimal integer; the next pointer must be a | |
419 | pointer to | |
420 | .IR "unsigned int" . | |
421 | .TP | |
422 | .B x | |
423 | Matches an unsigned hexadecimal integer; the next pointer must | |
424 | be a pointer to | |
425 | .IR "unsigned int" . | |
426 | .TP | |
427 | .B X | |
428 | Equivalent to | |
429 | .BR x . | |
430 | .TP | |
431 | .B f | |
432 | Matches an optionally signed floating-point number; the next pointer must | |
433 | be a pointer to | |
434 | .IR float . | |
435 | .TP | |
436 | .B e | |
437 | Equivalent to | |
438 | .BR f . | |
439 | .TP | |
440 | .B g | |
441 | Equivalent to | |
442 | .BR f . | |
443 | .TP | |
444 | .B E | |
445 | Equivalent to | |
446 | .BR f . | |
447 | .TP | |
991910a4 MK |
448 | .B a |
449 | (C99) Equivalent to | |
450 | .BR f . | |
451 | .TP | |
fea681da | 452 | .B s |
991910a4 | 453 | Matches a sequence of non-white-space characters; |
c13182ef | 454 | the next pointer must be a pointer to character array that is |
71d9e7ae MK |
455 | long enough to hold the input sequence and |
456 | the terminating null byte (\(aq\\0\(aq), which is added automatically. | |
991910a4 | 457 | The input string stops at white space or at the maximum field |
fea681da MK |
458 | width, whichever occurs first. |
459 | .TP | |
460 | .B c | |
991910a4 MK |
461 | Matches a sequence of characters whose length is specified by the |
462 | .I maximum field width | |
463 | (default 1); the next pointer must be a pointer to | |
fea681da | 464 | .IR char , |
0a5d2e21 MK |
465 | and there must be enough room for all the characters |
466 | (no terminating null byte is added). | |
c13182ef MK |
467 | The usual skip of leading white space is suppressed. |
468 | To skip white space first, use an explicit space in the format. | |
fea681da MK |
469 | .TP |
470 | .B \&[ | |
aa796481 | 471 | Matches a nonempty sequence of characters from the specified set of |
fea681da MK |
472 | accepted characters; the next pointer must be a pointer to |
473 | .IR char , | |
474 | and there must be enough room for all the characters in the string, plus a | |
28d88c17 | 475 | terminating null byte. |
c13182ef MK |
476 | The usual skip of leading white space is suppressed. |
477 | The string is to be made up of characters in (or not in) a particular set; | |
478 | the set is defined by the characters between the open bracket | |
fea681da MK |
479 | .B [ |
480 | character and a close bracket | |
481 | .B ] | |
c13182ef MK |
482 | character. |
483 | The set | |
fea681da MK |
484 | .I excludes |
485 | those characters if the first character after the open bracket is a | |
486 | circumflex | |
43daf87d | 487 | .RB ( ^ ). |
fea681da MK |
488 | To include a close bracket in the set, make it the first character after |
489 | the open bracket or the circumflex; any other position will end the set. | |
490 | The hyphen character | |
8c383102 | 491 | .B \- |
fea681da | 492 | is also special; when placed between two other characters, it adds all |
c13182ef MK |
493 | intervening characters to the set. |
494 | To include a hyphen, make it the last | |
495 | character before the final close bracket. | |
496 | For instance, | |
34131745 | 497 | .B [^]0\-9\-] |
991910a4 MK |
498 | means |
499 | the set "everything except close bracket, zero through nine, and hyphen". | |
fea681da MK |
500 | The string ends with the appearance of a character not in the (or, with a |
501 | circumflex, in) set or when the field width runs out. | |
502 | .TP | |
503 | .B p | |
c13182ef | 504 | Matches a pointer value (as printed by |
5adafd6d | 505 | .B %p |
991910a4 | 506 | in |
fea681da | 507 | .BR printf (3); |
475f1bca | 508 | the next pointer must be a pointer to a pointer to |
fea681da MK |
509 | .IR void . |
510 | .TP | |
511 | .B n | |
512 | Nothing is expected; instead, the number of characters consumed thus far | |
513 | from the input is stored through the next pointer, which must be a pointer | |
514 | to | |
515 | .IR int . | |
516 | This is | |
517 | .I not | |
93c2e069 JH |
518 | a conversion and does |
519 | .I not | |
520 | increase the count returned by the function. | |
521 | The assignment can be suppressed with the | |
fea681da | 522 | .B * |
93c2e069 JH |
523 | assignment-suppression character, but the effect on the |
524 | return value is undefined. | |
525 | Therefore | |
526 | .B %*n | |
527 | conversions should not be used. | |
47297adb | 528 | .SH RETURN VALUE |
c13182ef MK |
529 | These functions return the number of input items |
530 | successfully matched and assigned, | |
531 | which can be fewer than provided for, | |
991910a4 | 532 | or even zero in the event of an early matching failure. |
4d9b6984 MK |
533 | |
534 | The value | |
535 | .B EOF | |
c13182ef | 536 | is returned if the end of input is reached before either the first |
6e888f06 | 537 | successful conversion or a matching failure occurs. |
fea681da | 538 | .B EOF |
c13182ef | 539 | is also returned if a read error occurs, |
4d9b6984 MK |
540 | in which case the error indicator for the stream (see |
541 | .BR ferror (3)) | |
542 | is set, and | |
543 | .I errno | |
544 | is set indicate the error. | |
646af540 | 545 | .SH ERRORS |