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