1 .\" Copyright (c) 1990, 1991 The Regents of the University of California.
2 .\" All rights reserved.
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.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
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.
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
36 .\" @(#)scanf.3 6.14 (Berkeley) 1/8/93
38 .\" Converted for Linux, Mon Nov 29 15:22:01 1993, faith@cs.unc.edu
39 .\" modified to resemble the GNU libio setup used in the Linux libc
40 .\" used in versions 4.x (x>4) and 5 Helmut.Geyer@iwr.uni-heidelberg.de
41 .\" Modified, aeb, 970121
42 .\" 2005-07-14, mtk, added description of %n$ form; various text
43 .\" incorporated from the GNU C library documentation ((C) The
44 .\" Free Software Foundation); other parts substantially rewritten.
47 .\" Add ERRORS section.
48 .\" Document the 'a' and 'm' modifiers for dynamic string allocation.
50 .\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
51 .\" all rights reserved.
52 .\" Translated 1998-02-17, YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
53 .\" Updated 2003-02-23, Kentaro Shirakata <argrath@ub32.org>
54 .\" Updated 2005-09-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
55 .\" Updated 2008-08-11, Akihiro MOTOKI, LDP v3.05
57 .\"WORD: conversion specifications ÊÑ´¹»ØÄê
58 .\"WORD: type modifier ·¿½¤¾þ»Ò
60 .TH SCANF 3 2011-09-28 "GNU" "Linux Programmer's Manual"
63 .\"O scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf \- input format conversion
64 scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf \- ½ñ¼°ÉÕ¤ÆþÎÏÊÑ´¹
70 .BI "int scanf(const char *" format ", ...);"
71 .BI "int fscanf(FILE *" stream ", const char *" format ", ...);"
72 .BI "int sscanf(const char *" str ", const char *" format ", ...);"
74 .B #include <stdarg.h>
76 .BI "int vscanf(const char *" format ", va_list " ap );
77 .BI "int vsscanf(const char *" str ", const char *" format ", va_list " ap );
78 .BI "int vfscanf(FILE *" stream ", const char *" format ", va_list " ap );
82 .\"O Feature Test Macro Requirements for glibc (see
83 .\"O .BR feature_test_macros (7)):
84 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
85 .RB ( feature_test_macros (7)
94 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
95 _POSIX_C_SOURCE\ >=\ 200112L;
105 .\"O family of functions scans input according to
107 .\"O as described below.
108 .\"O This format may contain
109 .\"O .IR "conversion specifications" ;
110 .\"O the results from such conversions, if any,
111 .\"O are stored in the locations pointed to by the
113 .\"O arguments that follow
117 .\"O argument must be of a type that is appropriate for the value returned
118 .\"O by the corresponding conversion specification.
120 ´Ø¿ô¥°¥ë¡¼¥×¤Ï¡¢°Ê²¼¤Ë½Ò¤Ù¤ë¤è¤¦¤Ë¡¢
122 ¤Ë½¾¤Ã¤ÆÆþÎϤòÆɤ߹þ¤à¤â¤Î¤Ç¤¢¤ë¡£
124 .I "¡ÖÊÑ´¹»ØÄê¡× (conversion specifications)"
125 ¤ò´Þ¤á¤ë¤³¤È¤¬¤Ç¤¡¢ÊÑ´¹»ØÄ꤬¤¢¤ì¤Ð¡¢¤½¤ÎÊÑ´¹¤Î·ë²Ì¤Ï
129 °ú¤¿ô¤¬»Ø¤¹¾ì½ê¤Ë³ÊǼ¤µ¤ì¤ë¡£
132 °ú¤¿ô¤Î·¿¤Ï¡¢Âбþ¤¹¤ëÊÑ´¹»ØÄ꤬ÊÖ¤¹ÃͤË
133 Ŭ¹ç¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
135 .\"O If the number of conversion specifications in
137 .\"O exceeds the number of
139 .\"O arguments, the results are undefined.
140 .\"O If the number of
142 .\"O arguments exceeds the number of conversion specifications, then the excess
144 .\"O arguments are evaluated, but are otherwise ignored.
148 °ú¤¿ô¤Î¿ô¤è¤ê¿¤«¤Ã¤¿¾ì¹ç¤Î·ë²Ì¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£
150 °ú¤¿ô¤Î¿ô¤¬ÊÑ´¹»ØÄê¤Î¸Ä¿ô¤è¤ê¤â¿¤«¤Ã¤¿¾ì¹ç¡¢
153 °ú¤¿ô¤Îɾ²Á¤Ï¹Ô¤ï¤ì¤ë¤¬¡¢¤½¤ì°Ê³°¤Ï¹Ô¤ï¤ì¤ºÌµ»ë¤µ¤ì¤ë¡£
157 .\"O function reads input from the standard input stream
160 .\"O reads input from the stream pointer
164 .\"O reads its input from the character string pointed to by
167 ´Ø¿ô¤Ïɸ½àÆþÎÏ¥¹¥È¥ê¡¼¥à
169 ¤«¤é¤ÎÆþÎϤòÆɤ߹þ¤à¡£
173 ¤«¤é¤ÎÆþÎϤòÆɤ߹þ¤à¡£
177 ¤Ç¼¨¤µ¤ì¤¿Ê¸»úÎ󤫤é¤ÎÆþÎϤòÆɤ߹þ¤à¡£
181 .\"O function is analogous to
182 .\"O .BR vfprintf (3)
183 .\"O and reads input from the stream pointer
185 .\"O using a variable argument list of pointers (see
190 ¤ÈƱÍͤˡ¢¥¹¥È¥ê¡¼¥à¥Ý¥¤¥ó¥¿
192 ¤«¤é¤ÎÆþÎϤò¥Ý¥¤¥ó¥¿¤Î²ÄÊÑĹ°ú¤¿ô¥ê¥¹¥È¤òÍѤ¤¤ÆÆɤ߹þ¤à
197 .\"O function scans a variable argument list from the standard input and the
199 .\"O function scans it from a string; these are analogous to the
202 .\"O .BR vsprintf (3)
203 .\"O functions respectively.
205 ´Ø¿ô¤Ï¡¢²ÄÊÑĹ°ú¤¿ô¤Î¥ê¥¹¥È¤Ë´ð¤Å¤É¸½àÆþÎϤ«¤é¤ÎÆɤ߼è¤ê¤ò¹Ô¤¦¡£
207 ´Ø¿ô¤Ï¤½¤Î¥ê¥¹¥È¤Ë´ð¤Å¤Ê¸»úÎ󤫤éÆɤ߼è¤ë¡£
212 ´Ø¿ô¤Î´Ø·¸¤ÈƱÍͤǤ¢¤ë¡£
216 .\"O string consists of a sequence of
218 .\"O which describe how to process the sequence of input characters.
219 .\"O If processing of a directive fails, no further input is read, and
222 .\"O A "failure" can be either of the following:
223 .\"O .IR "input failure" ,
224 .\"O meaning that input characters were unavailable, or
225 .\"O .IR "matching failure" ,
226 .\"O meaning that the input was inappropriate (see below).
229 .I "¡ÖÌ¿Îá¡× (directive)"
230 ¤ÎÎó¤Ç¹½À®¤µ¤ì¤ë¡£Ì¿Îá¤ÏÆþÎÏʸ»ú¤Î·ÏÎó¤ò¤É¤Î¤è¤¦¤Ë½èÍý¤¹¤ë¤«¤ò»Ø¼¨¤¹¤ë
231 ¤â¤Î¤Ç¤¢¤ë¡£¤¢¤ëÌ¿Îá¤Î½èÍý¤¬¼ºÇÔ¤¹¤ë¤È¡¢ÆþÎϤϤ½¤ì°Ê¾åÆɤ߹þ¤Þ¤ì¤º¡¢
234 .I "¡ÖÆþÎϤμºÇÔ¡× (input failure)"
236 .I "¡Ö°ìÃפμºÇÔ¡× (matching failure)"
238 ÆþÎϤμºÇÔ¤ÏÆþÎÏʸ»ú¤¬»ÈÍѤǤ¤Ê¤«¤Ã¤¿¤³¤È¤ò°ÕÌ£¤·¡¢
239 °ìÃפμºÇÔ¤ÏÆþÎϤ¬ÉÔŬÀڤǤ¢¤Ã¤¿¤³¤È (²¼µ»²¾È) ¤ò°ÕÌ£¤¹¤ë¡£
241 .\"O A directive is one of the following:
242 Ì¿Îá¤Ï°Ê²¼¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë:
245 .\"O A sequence of white-space characters (space, tab, newline, etc.; see
246 .\"O .BR isspace (3)).
247 .\"O This directive matches any amount of white space,
248 .\"O including none, in the input.
249 ¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹ (¥¹¥Ú¡¼¥¹¡¢¥¿¥Ö¡¢²þ¹Ô¤Ê¤É;
252 ¤³¤ÎÌ¿Îá¤Ï¡¢ÆþÎÏÃæ¤ÎǤ°Õ¤Î¸Ä¿ô¤Î¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¤Ë°ìÃפ¹¤ë¡£
253 (¡Ö²¿¤â¤Ê¤·¡×¤Ë¤â°ìÃפ¹¤ë)¡£
256 .\"O An ordinary character (i.e., one other than white space or \(aq%\(aq).
257 .\"O This character must exactly match the next character of input.
258 Ä̾ïʸ»ú (¤Ä¤Þ¤ê¡¢¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¤È \(aq%\(aq °Ê³°¤Îʸ»ú)¡£
259 ¤³¤Îʸ»ú¤ÏÆþÎϤμ¡¤Îʸ»ú¤ËÀµ³Î¤Ë°ìÃפ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
262 .\"O A conversion specification,
263 .\"O which commences with a \(aq%\(aq (percent) character.
264 .\"O A sequence of characters from the input is converted according to
265 .\"O this specification, and the result is placed in the corresponding
268 .\"O If the next item of input does not match the conversion specification,
269 .\"O the conversion fails\(emthis is a
270 .\"O .IR "matching failure" .
271 ÊÑ´¹»ØÄê¡£ÊÑ´¹»ØÄê¤Ï \(aq%\(aq (¥Ñ¡¼¥»¥ó¥È) ʸ»ú¤Ç»Ï¤Þ¤ë¡£
272 ÆþÎϤµ¤ì¤¿Ê¸»ú¤Î·ÏÎó¤Ï¤³¤Î»ØÄê¤Ë¤â¤È¤Å¤¤¤ÆÊÑ´¹¤µ¤ì¡¢
275 °ú¤¿ô¤¬»Ø¤¹¾ì½ê¤Ë³ÊǼ¤µ¤ì¤ë¡£
276 ÆþÎϤμ¡¤Îʸ»ú¤¬ÊÑ´¹»ØÄê¤È°ìÃפ·¤Ê¤¤¾ì¹ç¤Ï¡¢ÊÑ´¹¤Ï¼ºÇÔ¤¹¤ë
278 .I "¡Ö°ìÃפμºÇÔ¡× (matching failure)"
282 .\"O .I conversion specification
285 .\"O begins with either the character \(aq%\(aq or the character sequence
286 .\"O "\fB%\fP\fIn\fP\fB$\fP"
287 .\"O (see below for the distinction) followed by:
291 ¤Ïʸ»ú \(aq%\(aq ¤«Ê¸»ú·ÏÎó "\fB%\fP\fIn\fP\fB$\fP"
292 (°ã¤¤¤Ë¤Ä¤¤¤Æ¤Ï¸å½Ò) ¤Ç»Ï¤Þ¤ê¡¢°Ê²¼¤ÎÍ×ÁǤ¬Â³¤¯¡£
295 .\"O An optional \(aq*\(aq assignment-suppression character:
297 .\"O reads input as directed by the conversion specification,
298 .\"O but discards the input.
299 .\"O No corresponding
301 .\"O argument is required, and this specification is not
302 .\"O included in the count of successful assignments returned by
304 ÂåÆþÍÞÀ©Ê¸»ú \(aq*\(aq (¾Êά²Äǽ)¡£
306 ¤ÏÊÑ´¹»ØÄê¤Ë»Ø¼¨¤µ¤ì¤¿Ä̤êÆþÎϤòÆɤ߹þ¤à¤¬¡¢¤½¤ÎÆþÎϤϼΤƤé¤ì¤ë¡£
311 ¤¬ÊÖ¤¹ÂåÆþ¤¬À®¸ù¤·¤¿¿ô¤Ë¤³¤Î»ØÄê¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£
314 .\"O An optional \(aqa\(aq character.
315 .\"O This is used with string conversions, and relieves the caller of the
316 .\"O need to allocate a corresponding buffer to hold the input: instead,
318 .\"O allocates a buffer of sufficient size,
319 .\"O and assigns the address of this buffer to the corresponding
321 .\"O argument, which should be a pointer to a
323 .\"O variable (this variable does not need to be initialized before the call).
324 .\"O The caller should subsequently
326 .\"O this buffer when it is no longer required.
327 .\"O This is a GNU extension;
328 .\"O C99 employs the \(aqa\(aq character as a conversion specifier (and
329 .\"O it can also be used as such in the GNU implementation).
330 ʸ»ú \(aqa\(aq (¾Êά²Äǽ)¡£¤³¤ì¤Ïʸ»úÎóÊÑ´¹¤È¤È¤â¤Ë»ÈÍѤµ¤ì¡¢¤³¤ì¤ò»È¤¦¤È
331 ¸Æ¤Ó½Ð¤·¸µ¤¬ÆþÎϤòÊÝ»ý¤¹¤ëÂбþ¤¹¤ë¥Ð¥Ã¥Õ¥¡¤ò³ÎÊݤ¹¤ëɬÍפ¬¤Ê¤¯¤Ê¤ë¡£
334 ¤¬É¬ÍפÊÂ礤µ¤Î¥Ð¥Ã¥Õ¥¡¤ò³ÎÊݤ·¡¢¤³¤Î¥Ð¥Ã¥Õ¥¡¤Î¥¢¥É¥ì¥¹¤ò
341 ·¿¤ÎÊÑ¿ô¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤
342 (ÊÑ¿ô¼«ÂΤϸƤӽФ·Á°¤Ë½é´ü²½¤µ¤ì¤Æ¤¤¤ëɬÍפϤʤ¤)¡£
343 ¸Æ¤Ó½Ð¤·¸µ¤Ï¡¢ÉÔÍפˤʤä¿»þÅÀ¤Ç¡¢¤³¤Î¥Ð¥Ã¥Õ¥¡¤ò
345 ¤¹¤Ù¤¤Ç¤¢¤ë¡£¤³¤Îµ¡Ç½¤Ï GNU ¤Ë¤è¤ë³ÈÄ¥¤Ç¤¢¤ë¡£
346 C99 ¤Ï \(aqa\(aq ʸ»ú¤òÊÑ´¹»ØÄê¤È¤·¤Æ»ÈÍѤ·¤Æ¤¤¤ë
347 (¤³¤Á¤é¤â GNU ¤Î¼ÂÁõ¤ÈƱ¤¸¤è¤¦¤Ë»ÈÍѤ¹¤ë¤³¤È¤¬¤Ç¤¤ë)¡£
350 .\"O An optional decimal integer which specifies the
351 .\"O .IR "maximum field width" .
352 .\"O Reading of characters stops either when this maximum is reached or
353 .\"O when a nonmatching character is found, whichever happens first.
354 .\"O Most conversions discard initial white space characters (the exceptions
355 .\"O are noted below),
356 .\"O and these discarded characters don't count toward the maximum field width.
357 .\"O String input conversions store a terminating null byte (\(aq\\0\(aq)
358 .\"O to mark the end of the input;
359 .\"O the maximum field width does not include this terminator.
360 .I "¡ÖºÇÂç¥Õ¥£¡¼¥ë¥ÉÉý¡×"
361 ¤ò»ØÄꤹ¤ë 10¿Ê¿ô (¾Êά²Äǽ)¡£
362 ¤³¤ÎºÇÂçÃͤË㤹¤ë¤«¡¢°ìÃפ·¤Ê¤¤Ê¸»ú¤¬¸«¤Ä¤«¤ë¤«¡¢¤Î¤É¤Á¤é¤«¤Ë
363 ¤Ê¤ë¤È¡¢Ê¸»ú¤ÎÆɤ߹þ¤ß¤òÄä»ß¤¹¤ë¡£
364 ¤Û¤È¤ó¤É¤ÎÊÑ´¹¤Ç¤Ï¡¢ÀèƬ¤Î¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹Ê¸»ú¤Ï¼Î¤Æ¤é¤ì
365 (Îã³°¤Ë¤Ä¤¤¤Æ¤Ï¸å½Ò¤¹¤ë)¡¢
366 ¼Î¤Æ¤é¤ì¤¿¤³¤ì¤é¤Îʸ»ú¤ÏºÇÂç¥Õ¥£¡¼¥ë¥ÉÉý¤Î·×»»¤Ë¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£
367 ʸ»úÎó¤ÎÆþÎÏÊÑ´¹¤Ç¤Ï¡¢ÆþÎϤÎËöÈø¤ò¼¨¤¹½ªÃ¼¤Î NULL ¥Ð¥¤¥È (\(aq\\0\(aq)
368 ¤â³ÊǼ¤µ¤ì¤ë¤¬¡¢ºÇÂç¥Õ¥£¡¼¥ë¥ÉÉý¤Ë¤Ï¤³¤Î½ªÃ¼¥Ð¥¤¥È¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£
372 .\"O .IR "type modifier character" .
373 .\"O For example, the
375 .\"O type modifier is used with integer conversions such as
377 .\"O to specify that the corresponding
379 .\"O argument refers to a
381 .\"O rather than a pointer to an
383 .I "¡Ö·¿½¤¾þ»Ò¡× (type modifier characters)"
389 ¤Ê¤É¤ÎÀ°¿ôÊÑ´¹¤È°ì½ï¤Ë»È¤¦¤È¡¢Âбþ¤¹¤ë
395 ¤ò»²¾È¤·¤Æ¤¤¤ë¤³¤È¤ò»ØÄê¤Ç¤¤ë¡£
399 .\"O .I "conversion specifier"
400 .\"O that specifies the type of input conversion to be performed.
402 : ¼Â¹Ô¤¹¤Ù¤ÆþÎÏÊÑ´¹¤Î¼ïÎà¤ò»ØÄꤹ¤ë¡£
404 .\"O The conversion specifications in
406 .\"O are of two forms, either beginning with \(aq%\(aq or beginning with
407 .\"O "\fB%\fP\fIn\fP\fB$\fP".
408 .\"O The two forms should not be mixed in the same
410 .\"O string, except that a string containing
411 .\"O "\fB%\fP\fIn\fP\fB$\fP"
412 .\"O specifications can include
417 Ãæ¤ÎÊÑ´¹»ØÄê¤Ï¡¢\(aq%\(aq ¤Ç»Ï¤Þ¤ë¤«¡¢
418 "\fB%\fP\fIn\fP\fB$\fP" ¤Ç»Ï¤Þ¤ë¤«¤Î¡¢¤¤¤º¤ì¤«¤Î·Á¼°¤Ç¤¢¤ë¡£
419 ¤³¤ì¤é 2¤Ä¤Î·Á¼°¤òƱ¤¸
421 ʸ»úÎó¤Ëº®¤¼¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£Ã¢¤·¡¢"\fB%\fP\fIn\fP\fB$\fP" ¤ò
426 ¤ò´Þ¤á¤ë¤³¤È¤Ï¤Ç¤¤ë¡£
429 .\"O contains \(aq%\(aq
430 .\"O specifications then these correspond in order with successive
434 ¤Ë \(aq%\(aq »ØÄ꤬´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢³Æ¡¹¤Î \(aq%\(aq »ØÄê¤È
437 °ú¤¿ô¤Ï¤½¤Î½çÈÖÄ̤ê¤ËÂбþ¤¹¤ë¡£
439 .\"O "\fB%\fP\fIn\fP\fB$\fP"
440 .\"O form (which is specified in POSIX.1-2001, but not C99),
442 .\"O is a decimal integer that specifies that the converted input should
443 .\"O be placed in the location referred to by the
446 .\"O argument following
448 "\fB%\fP\fIn\fP\fB$\fP" ·Á¼°
449 (POSIX.1-2001 ¤Ç¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤ë¤¬¡¢C99 ¤Ë¤Ï¤Ê¤¤)
452 ¤Ï 10¿Ê¿ô¤Ç¤¢¤ê¡¢ÊÑ´¹¸å¤ÎÆþÎϤò
458 °ú¤¿ô¤¬»²¾È¤¹¤ë¾ì½ê¤Ë³ÊǼ¤¹¤ë¤³¤È¤ò»ØÄꤹ¤ë¡£
462 .\"O .I "type modifier characters"
463 .\"O can appear in a conversion specification:
466 ¤òÆþ¤ì¤ë¤³¤È¤¬¤Ç¤¤ë¡£
469 .\"O Indicates that the conversion will be one of
470 .\"O \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, \fBx\fP, \fBX\fP, or \fBn\fP
471 .\"O and the next pointer is a pointer to a
474 .\"O .I unsigned short int
478 \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, \fBx\fP, \fBX\fP, \fBn\fP
479 ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢¼¡¤Î¥Ý¥¤¥ó¥¿¤¬
484 .I unsigned short int
485 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
490 .\"O but the next pointer is a pointer to a
493 .\"O .IR "unsigned char" .
495 ¤ÈƱ¤¸¤À¤¬¡¢¼¡¤Î¥Ý¥¤¥ó¥¿¤¬
499 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
504 .\"O but the next pointer is a pointer to an
508 .\"O This modifier was introduced in C99.
510 ¤ÈƱ¤¸¤À¤¬¡¢¼¡¤Î¥Ý¥¤¥ó¥¿¤¬
514 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
515 ¤³¤Î½¤¾þ»Ò¤Ï C99 ¤ÇƳÆþ¤µ¤ì¤¿¡£
518 .\"O Indicates either that the conversion will be one of
519 .\"O \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, \fBx\fP, \fBX\fP, or \fBn\fP
520 .\"O and the next pointer is a pointer to a
523 .\"O .I unsigned long int
526 .\"O or that the conversion will be one of
527 .\"O \fBe\fP, \fBf\fP, or \fBg\fP
528 .\"O and the next pointer is a pointer to
533 \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, \fBx\fP, \fBX\fP, \fBn\fP
536 ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¼¡¤Î¥Ý¥¤¥ó¥¿¤¬
542 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤³¤È¡¢¤Þ¤¿¤Ï¡¢ÊÑ´¹¤¬
543 \fBe\fP, \fBf\fP, \fBg\fP
544 ¤Î¤¦¤Á¤Î¤Ò¤È¤Ä¤Ç¤¢¤ê¼¡¤Î¥Ý¥¤¥ó¥¿¤¬
548 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤³¤È¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
551 .\"O characters is equivalent to
557 .\"O the corresponding parameter is considered
558 .\"O as a pointer to a wide character or wide-character string respectively.
559 .\"O .\" This use of l was introduced in Amendment 1 to ISO C90.
561 ʸ»ú¤òÆó¤Ä»ØÄꤹ¤ë¤È¡¢
568 ¥Ñ¥é¥á¡¼¥¿¤Ï¤½¤ì¤¾¤ì¥ï¥¤¥Éʸ»ú¤ä¥ï¥¤¥Éʸ»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤È
570 .\" l ¤Î¤³¤Î»ÈÍÑË¡¤Ï ISO C90 ¤Î Amendment 1 ¤ÇƳÆþ¤µ¤ì¤¿¡£
573 .\"O Indicates that the conversion will be either
574 .\"O \fBe\fP, \fBf\fP, or \fBg\fP
575 .\"O and the next pointer is a pointer to
576 .\"O .I "long double"
577 .\"O or the conversion will be
578 .\"O \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, or \fBx\fP
579 .\"O and the next pointer is a pointer to
580 .\"O .IR "long long" .
581 \fBe\fP, \fBf\fP, \fBg\fP
582 ÊÑ´¹¤Ç¡¢¼¡¤Î¥Ý¥¤¥ó¥¿¤¬
584 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£¤â¤·¤¯¤Ï¡¢
585 \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, \fBx\fP
586 ÊÑ´¹¤Ç¡¢¼¡¤Î¥Ý¥¤¥ó¥¿¤¬
588 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤³¤È¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
589 .\"O .\" MTK, Jul 05: The following is no longer true for modern
590 .\"O .\" ANSI C (i.e., C99):
591 .\"O .\" (Note that long long is not an
593 .\"O .\" type. Any program using this will not be portable to all
594 .\"O .\" architectures).
595 .\" MTK, Jul 05: °Ê²¼¤ÎÆâÍƤϿ·¤·¤¤ ANSI C (¤Ä¤Þ¤ê C99) ¤Ç¤Ï
596 .\" ¤â¤Ï¤äÀµ¤·¤¯¤Ê¤¤¡£
599 .\" ¤Çµ¬Äꤵ¤ì¤¿·¿¤Ç¤Ï¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤è¤¦¡£
600 .\" ¤³¤ì¤òÍѤ¤¤¿¥×¥í¥°¥é¥à¤ÏÁ´¤Æ¤Î¥¢¡¼¥¥Æ¥¯¥Á¥ã¤ËÂФ·¤Æ
601 .\" °Ü¿¢²Äǽ¤Ç¤Ï¤Ê¤¤¡£)
606 .\"O This specifier does not exist in ANSI C.
609 ¤³¤Î½¤¾þ»Ò¤Ï ANSI C ¤Ë¤Ï¸ºß¤·¤Ê¤¤¡£
614 .\"O but the next pointer is a pointer to a
616 .\"O This modifier was introduced in C99.
618 ¤ÈƱÍͤÀ¤¬¡¢¼¡¤Î¥Ý¥¤¥ó¥¿¤¬
620 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
621 ¤³¤Î½¤¾þ»Ò¤Ï C99 ¤ÇƳÆþ¤µ¤ì¤¿¡£
626 .\"O but the next pointer is a pointer to a
628 .\"O This modifier was introduced in C99.
630 ¤ÈƱÍͤÀ¤¬¡¢¼¡¤Î¥Ý¥¤¥ó¥¿¤¬
632 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
633 ¤³¤Î½¤¾þ»Ò¤Ï C99 ¤ÇƳÆþ¤µ¤ì¤¿¡£
636 .\"O .I "conversion specifiers"
643 .\"O Matches a literal \(aq%\(aq.
646 .\"O in the format string matches a
647 .\"O single input \(aq%\(aq character.
648 .\"O No conversion is done (but initial white space characters are discarded),
649 .\"O and assignment does not occur.
650 ʸ»ú \(aq%\(aq ¤ËÂбþ¤¹¤ë¡£
653 ¤Ïñ°ì¤Îʸ»ú \(aq%\(aq ¤ËÂбþ¤¹¤ë¡£
654 ÊÑ´¹¤Ï¹Ô¤ï¤ì¤º (⤷¡¢ÀèƬ¤Î¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹Ê¸»ú¤Ï¼Î¤Æ¤é¤ì¤ë)¡¢
655 ÊÑ¿ô¤Ø¤ÎÂåÆþ¤ÏÀ¸¤¸¤Ê¤¤¡£
658 .\"O Matches an optionally signed decimal integer;
659 .\"O the next pointer must be a pointer to
661 Éä¹æ¤Ä¤¤Î 10¿Ê¤ÎÀ°¿ô¤ËÂбþ¤¹¤ë¡£
664 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
669 .\"O this exists only for backward compatibility.
670 .\"O (Note: thus only in libc4.
671 .\"O In libc5 and glibc the
673 .\"O is silently ignored, causing old programs to fail mysteriously.)
675 ¤ÈƱ°ì¤Ç¤¢¤ë¡£¤³¤ì¤Ï°ÊÁ°¤Î»ÅÍͤȤθߴ¹À¤À¤±¤Î¤¿¤á¤Ë¤¢¤ë¡£
676 (Ãí°Õ: ¤³¤ì¤Ï libc4 ¤Î¾ì¹ç¤À¤±¤Ç¤¢¤ë¡£ libc5 ¤ä glibc ¤Ç¤Ï
678 ¤Ï°ÅÌۤΤ¦¤Á¤Ë̵»ë¤µ¤ì¡¢¸Å¤¤¥×¥í¥°¥é¥à¤Ë¤ª¤¤¤ÆÆæ¤ËËþ¤Á¤¿¼ºÇԤθ¶°ø¤È¤Ê¤ë¡£)
681 .\"O Matches an optionally signed integer; the next pointer must be a pointer to
683 .\"O The integer is read in base 16 if it begins with
687 .\"O in base 8 if it begins with
689 .\"O and in base 10 otherwise.
690 .\"O Only characters that correspond to the base are used.
691 Éä¹æ¤Ä¤À°¿ô¤ËÂбþ¤¹¤ë¡£
694 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
699 ¤Ç³«»Ï¤¹¤ë¾ì¹ç¤Ë¤Ï 16 ¿Ê¿ô¡¢
701 ¤Ç³«»Ï¤¹¤ë¾ì¹ç¤Ë¤Ï 8 ¿Ê¿ô¡¢¤½¤Î¾¤Î¾ì¹ç¤Ë¤Ï 10¿Ê¿ô¤È¤·¤ÆÆɤ߹þ¤Þ¤ì¤ë¡£
702 ¤³¤ÎÊÑ´¹¤Ç»ÈÍѤµ¤ì¤ëʸ»ú¤Ï¡¢¤³¤ì¤é¤Î´ð¿ô¤ËÂбþ¤·¤Æ¤¤¤ë¤â¤Î¤À¤±¤Ç¤¢¤ë¡£
705 .\"O Matches an unsigned octal integer; the next pointer must be a pointer to
706 .\"O .IR "unsigned int" .
707 Éä¹æ¤Ê¤·¤Î 8 ¿Ê¤ÎÀ°¿ô¤ËÂбþ¤¹¤ë¡£
713 .\"O Matches an unsigned decimal integer; the next pointer must be a
715 .\"O .IR "unsigned int" .
716 Éä¹æ¤Ê¤·¤Î 10¿Ê¤ÎÀ°¿ô¤ËÂбþ¤¹¤ë¡£
719 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
722 .\"O Matches an unsigned hexadecimal integer; the next pointer must
724 .\"O .IR "unsigned int" .
725 Éä¹æ¤Ê¤·¤Î 16 ¿Ê¤ÎÀ°¿ô¤ËÂбþ¤¹¤ë¡£
728 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
737 .\"O Matches an optionally signed floating-point number; the next pointer must
740 Éä¹æ¤Ä¤ÉâÆ°¾®¿ôÅÀ¼Â¿ô¤ËÂбþ¤¹¤ë¡£
743 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
764 .\"O (C99) Equivalent to
771 .\"O Matches a sequence of non-white-space characters;
772 .\"O the next pointer must be a pointer to character array that is
773 .\"O long enough to hold the input sequence and
774 .\"O the terminating null byte (\(aq\\0\(aq), which is added automatically.
775 .\"O The input string stops at white space or at the maximum field
776 .\"O width, whichever occurs first.
777 ¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¤Ç¤Ï¤Ê¤¤Ê¸»ú¤Ç¹½À®¤µ¤ì¤¿Ê¸»úÎó¤ËÂбþ¤¹¤ë¡£
778 ¼¡¤Î¥Ý¥¤¥ó¥¿¤Ïʸ»ú¤ÎÇÛÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤º¡¢
779 ¤½¤Îʸ»úÇÛÎó¤Ï¡¢ÆþÎϤµ¤ì¤¿Ê¸»úÎó¤È (¼«Æ°Åª¤ËÄɲ䵤ì¤ë) ½ªÃ¼¤Î NULL
780 ¥Ð¥¤¥È (\(aq\\0\(aq) ¤ò³ÊǼ¤¹¤ë¤Î¤Ë½½Ê¬¤ÊÂ礤µ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
781 ʸ»úÎó¤ÎÆþÎϤϡ¢¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¤¬ÆþÎϤµ¤ì¤ë¤«¡¢ºÇÂç¥Õ¥£¡¼¥ë¥ÉÉý¤Ë
782 㤹¤ë¤«¡¢¤Î¤É¤Á¤é¤«¤¬µ¯¤³¤ë¤ÈÄä»ß¤µ¤ì¤ë¡£
785 .\"O Matches a sequence of characters whose length is specified by the
786 .\"O .I maximum field width
787 .\"O (default 1); the next pointer must be a pointer to
789 .\"O and there must be enough room for all the characters (no terminating
792 .\"O The usual skip of leading white space is suppressed.
793 .\"O To skip white space first, use an explicit space in the format.
794 .I "¡ÖºÇÂç¥Õ¥£¡¼¥ë¥ÉÉý¡×"
795 (¥Ç¥Õ¥©¥ë¥È¤Ï 1) ¤Ç»ØÄꤵ¤ì¤¿Éý¤Îʸ»ú¤ÎÎó¤ËÂбþ¤¹¤ë¡£
798 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¡¢¤¹¤Ù¤Æ¤Îʸ»ú¤ò³ÊǼ¤¹¤ë¤Î¤Ë½½Ê¬¤ÊÎΰ褬
799 ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤ (½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤ÏÄɲ䵤ì¤Ê¤¤)¡£
800 Ä̾ï¹Ô¤ï¤ì¤ëÀèƬ¤Î¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¤ÎÆɤßÈô¤Ð¤·¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£
801 ÀèƬ¤Î¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¤òÆɤßÈô¤Ð¤¹¤¿¤á¤Ë¤Ï¡¢
802 ¥Õ¥©¡¼¥Þ¥Ã¥Èʸ¤ÎÃæ¤ÇÌÀ¼¨Åª¤Ë¥¹¥Ú¡¼¥¹¤ò»ÈÍѤ¹¤ì¤ÐÎɤ¤¡£
805 .\"O Matches a nonempty sequence of characters from the specified set of
806 .\"O accepted characters; the next pointer must be a pointer to
808 .\"O and there must be enough room for all the characters in the string, plus a
809 .\"O terminating null byte.
810 .\"O The usual skip of leading white space is suppressed.
811 ³ÊǼ¤µ¤ì¤¿Ê¸»úÎó¤Î¤¦¤Á¤«¤é¼è¤ê½Ð¤µ¤ì¤¿¡¢
812 »ØÄꤵ¤ì¤¿Ê¸»ú¤Î½¸¹ç¤Ç¹½À®¤µ¤ì¤ë¶õ¤Ç¤Ï¤Ê¤¤Ê¸»ú¤ÎÎó¤ËÂбþ¤¹¤ë¡£
815 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤º¡¢
816 ¤½¤³¤Ë¤Ïʸ»úÎóÃæ¤Î¤¹¤Ù¤Æ¤Îʸ»ú¤È½ªÃ¼¤Î NULL ¥Ð¥¤¥È
817 ¤ò³ÊǼ¤¹¤ë¤¿¤á¤Î½½Ê¬¤ÊÎΰ褬¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
818 Ä̾ï¹Ô¤ï¤ì¤ëÀèƬ¤Î¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¤ÎÆɤßÈô¤Ð¤·¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£
819 .\"O The string is to be made up of characters in (or not in) a particular set;
820 .\"O the set is defined by the characters between the open bracket
822 .\"O character and a close bracket
827 .\"O those characters if the first character after the open bracket is a
830 ¤³¤Îʸ»úÎó¤ÏÆÃÊ̤ʽ¸¹ç¤ÎÃæ¤Îʸ»ú¤Ç¹½À®¤µ¤ì¤Æ¤¤¤ë¡£
836 ¤Î´Ö¤Îʸ»ú¤ÇÄêµÁ¤µ¤ì¤ë¡£
837 ³«¤³ç¸Ì¤Î¤¢¤È¤ÎºÇ½é¤Îʸ»ú¤¬¶Ê¥¢¥¯¥»¥ó¥Èµ¹æ
839 ¤Î¾ì¹ç¡¢½¸¹ç¤Ï¤³¤ì¤é¤Îʸ»ú¤ò´Þ¤Þ¤Ê¤¤¤â¤Î¤È¤Ê¤ë¡£
840 .\"O To include a close bracket in the set, make it the first character after
841 .\"O the open bracket or the circumflex; any other position will end the set.
842 .\"O The hyphen character
844 .\"O is also special; when placed between two other characters, it adds all
845 .\"O intervening characters to the set.
846 .\"O To include a hyphen, make it the last
847 .\"O character before the final close bracket.
848 ÊĤ¸³ç¸Ì¤ò½¸¹ç¤Ë´Þ¤Þ¤»¤ë¤¿¤á¤Ë¤Ï¡¢¤³¤Îʸ»ú¤ò³«¤³ç¸Ì¤Þ¤¿¤Ï
849 ¶Ê¥¢¥¯¥»¥ó¥Èµ¹æ¤Î¤¢¤È¤ÎºÇ½é¤Îʸ»ú¤Ë¤¹¤ì¤Ð¤è¤¤¡£
850 ¤Ä¤Þ¤ê¡¢Â¾¤Î°ÌÃÖ¤ËÊĤ¸³ç¸Ì¤òÃÖ¤¯¤Èʸ»ú¤Î½¸¹ç¤¬½ª¤ë¡£
853 ¤â¤Þ¤¿Æüìʸ»ú¤Ç¤¢¤ë¡£
854 Æó¤Ä¤Î°Û¤Ê¤ëʸ»ú¤Î´Ö¤ËÃÖ¤«¤ì¤¿»þ¡¢¤³¤Îʸ»ú¤Ï¡¢
855 ¤½¤Î´Ö¤Ë¤¢¤ëÁ´¤Æ¤Îʸ»ú¤ò½¸¹ç¤Ë²Ã¤¨¤ë¡£
856 ¥Ï¥¤¥Õ¥ó¼«ÂΤò´Þ¤Þ¤»¤ë¤¿¤á¤Ë¤Ï¡¢
857 ³ç¸Ì¤¬ÊĤ¸¤ëÁ°¤ÎºÇ¸å¤Î°ìʸ»ú¤ò¥Ï¥¤¥Õ¥ó¤Ë¤¹¤ì¤Ð¤è¤¤¡£
861 .\"O the set "everything except close bracket, zero through nine, and hyphen".
862 .\"O The string ends with the appearance of a character not in the (or, with a
863 .\"O circumflex, in) set or when the field width runs out.
866 ¤Ï¡ÖÊĤ¸³ç¸Ì¡¢0 ¡Á 9¡¢¥Ï¥¤¥Õ¥ó¤Î 3 ¼ïÎà¤ò½ü¤¯Á´¤Æ¤Îʸ»ú¡×¤Î½¸¹ç¤ò°ÕÌ£¤¹¤ë¡£
868 ½¸¹ç¤Ë´Þ¤Þ¤ì¤Æ¤¤¤Ê¤¤ (¶Ê¥¢¥¯¥»¥ó¥È¤Î¾ì¹ç¤Ë¤Ï´Þ¤Þ¤ì¤ë) ʸ»ú¤Î
869 ½Ð¸½¤Þ¤¿¤Ï³ÎÊݤµ¤ì¤¿Îΰ褬»È¤¤ÀÚ¤é¤ì¤¿»þ¤Ë½ªÎ»¤¹¤ë¡£
872 .\"O Matches a pointer value (as printed by
876 .\"O the next pointer must be a pointer to a pointer to
881 ¤Ç°õ»ú¤µ¤ì¤ë¤è¤¦¤Ê) ¥Ý¥¤¥ó¥¿ÃͤËÂбþ¤¹¤ë¡£
884 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
887 .\"O Nothing is expected; instead, the number of characters consumed thus far
888 .\"O from the input is stored through the next pointer, which must be a pointer
891 ¤É¤ó¤ÊÆþÎϤâɬÍפȤ·¤Ê¤¤¡£
893 ÆþÎϤ«¤é¤³¤³¤Þ¤Ç¾ÃÈñ¤µ¤ì¤¿Ê¸»ú¿ô¤¬¼¡¤Î¥Ý¥¤¥ó¥¿¤Ç»ØÄꤵ¤ì¤¿¾ì½ê¤Ë
897 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
900 .\"O a conversion, although it can be suppressed with the
902 .\"O assignment-suppression character.
903 ÊÑ´¹¤òÍÞÀ©¤¹¤ë¤Î¤Ç¤¢¤ì¤Ð
905 ÂåÆþÍÞÀ©Ê¸»ú¤ò»È¤Ã¤ÆÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¤Î¤À¤¬¡¢
906 ¤³¤ÎÊÑ´¹»ØÄê»Ò¤ÏÊÑ´¹¤Ç¤Ï¡Ö¤Ê¤¤¡×¡£
907 .\"O The C standard says: "Execution of a
909 .\"O directive does not increment
910 .\"O the assignment count returned at the completion of execution"
911 .\"O but the Corrigendum seems to contradict this.
912 .\"O Probably it is wise
913 .\"O not to make any assumptions on the effect of
915 .\"O conversions on the return value.
916 C ¸À¸ì¤Îɸ½àµ¬³Ê¤Ç¤Ï¡Ö¼Â¹Ô¤Î´°Î»»þ¤ËÊÖ¤µ¤ì¤ëÂåÆþ¤Î²ó¿ô¤Ï
918 Ì¿Îá¤Î¼Â¹Ô¤Ç¤ÏÁý²Ã¤·¤Ê¤¤¡×¤È¤Ê¤Ã¤Æ¤¤¤ë¤¬¡¢
919 Àµ¸íɽ¤ÎÆâÍƤϤ³¤ì¤ÈÌ·½â¤¹¤ë¤è¤¦¤Ç¤¢¤ë¡£¤ª¤½¤é¤¯¡¢
921 ÊÑ´¹¤¬ÊÖ¤êÃͤËÍ¿¤¨¤ë±Æ¶Á¤Ë¤Ä¤¤¤Æ¤Ï¤É¤Î¤è¤¦¤Ê²¾Äê¤â¤·¤Ê¤¤¤Î¤¬
923 .\"O .SH "RETURN VALUE"
925 .\"O These functions return the number of input items
926 .\"O successfully matched and assigned,
927 .\"O which can be fewer than provided for,
928 .\"O or even zero in the event of an early matching failure.
929 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢°ìÃפÈÂåÆþ¤¬À®¸ù¤·¤¿ÆþÎÏÍ×ÁǤθĿô¤òÊÖ¤¹¡£
930 ÊÖ¤µ¤ì¤ëÃͤÏÅϤµ¤ì¤¿ÊÑ´¹¤Î¸Ä¿ô¤è¤ê¤â¾¯¤Ê¤¤¤³¤È¤â¤¢¤ê¡¢
931 ºÇ½é¤Ë°ìÃפμºÇÔ¤¬¤¢¤Ã¤¿¾ì¹ç¤Ë¤Ï 0 ¤Ë¤Ê¤ë¤³¤È¤â¤¢¤ë¡£
935 .\"O is returned if the end of input is reached before either the first
936 .\"O successful conversion or a matching failure occurs.
938 .\"O is also returned if a read error occurs,
939 .\"O in which case the error indicator for the stream (see
943 .\"O is set indicate the error.
944 ºÇ½é¤ÎÊÑ´¹¤¬À®¸ù¤¹¤ëÁ°¤ËÆþÎϤκǸå¤Ë㤷¤Æ¡¢°ìÃפμºÇÔ¤¬µ¯¤³¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢
947 Æɤ߹þ¤ß¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ë¤â
949 ¤¬ÊÖ¤µ¤ì¤ë¡£Æɤ߹þ¤ß¥¨¥é¡¼¤Î¾ì¹ç¤Ë¤Ï¡¢¤½¤Î¥¹¥È¥ê¡¼¥à¤Î
950 ¥¨¥é¡¼»Ø¼¨»Ò¤¬¥»¥Ã¥È¤µ¤ì
954 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹Ãͤ¬¥»¥Ã¥È¤µ¤ì¤ë¡£
959 .\"O The file descriptor underlying
961 .\"O is marked nonblocking, and the read operation would block.
963 ¤ËÂбþ¤¹¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬ nonblocking ¤È¤Ê¤Ã¤Æ¤ª¤ê¡¢
964 Æɤ߹þ¤ßÁàºî¤ÏÄä»ß (block) ¤¹¤ë¤³¤È¤Ë¤Ê¤ë¡£
967 .\"O The file descriptor underlying
969 .\"O is invalid, or not open for reading.
971 ¤ËÂбþ¤¹¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬Ìµ¸ú¤Ç¤¢¤ë¤¬¡¢
972 Æɤ߹þ¤ßÍѤ˥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
975 .\"O Input byte sequence does not form a valid character.
976 ÆþÎϤµ¤ì¤¿¥Ð¥¤¥ÈÎó¤¬Í¸ú¤Êʸ»ú¤ò¹½À®¤·¤Æ¤¤¤Ê¤¤¡£
979 .\"O The read operation was interrupted by a signal; see
981 Æɤ߹þ¤ßÁàºî¤¬¥·¥°¥Ê¥ë¤Ë¤è¤ê³ä¤ê¹þ¤Þ¤ì¤¿¡£
986 .\"O Not enough arguments; or
989 °ú¤¿ô¤¬½½Ê¬¤Ç¤Ê¤¤¡£¤Þ¤¿¤Ï
998 .\"O The result of an integer conversion would exceed the size
999 .\"O that can be stored in the corresponding integer type.
1000 À°¿ôÊÑ´¹¤Î·ë²Ì¤¬¡¢Âбþ¤¹¤ëÀ°¿ô·¿¤Ë³ÊǼ¤Ç¤¤ë¥µ¥¤¥º¤ò±Û¤¨¤Æ¤·¤Þ¤¦¡£
1001 .\"O .SH "CONFORMING TO"
1008 .\"O conform to C89 and C99 and POSIX.1-2001.
1009 .\"O These standards do not specify the
1015 ´Ø¿ô¤Ï C89, C99, POSIX.1-2001 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
1016 ¤³¤ì¤é¤Îɸ½à¤Ç¤Ï¡¢¥¨¥é¡¼
1018 ¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
1022 .\"O specifier is the 4.4BSD notation for
1023 .\"O .IR "long long" ,
1027 ¤Î 4.4BSD ¤Ç¤Îµ½ÒÊýË¡¤Ç¤¢¤ë¡£
1030 .\"O or the usage of
1032 .\"O in integer conversions is the GNU notation.
1037 ¤Î»ÈÍÑ¤Ï GNU ¤Ç¤Î³ÈÄ¥¤Ç¤¢¤ë¡£
1039 .\"O The Linux version of these functions is based on the
1043 .\"O Take a look at the
1045 .\"O documentation of
1047 .\"O .I libc (glibc-1.08)
1048 .\"O for a more concise description.
1049 ¤³¤ì¤é¤Î´Ø¿ô¤Î Linux ÈǤÏ
1052 ¥é¥¤¥Ö¥é¥ê¡¼¤ò¸µ¤Ë¤·¤Æ¤¤¤ë¡£
1055 .I libc (glibc-1.08)
1058 ʸ½ñ¤ËÌܤòÄ̤¹¤³¤È¡£
1061 .\"O The GNU C library supports a nonstandard extension that causes
1062 .\"O the library to dynamically allocate a string of sufficient size
1063 .\"O for input strings for the
1066 .\"O \fB%a[\fP\fIrange\fP\fB]\fP
1067 .\"O conversion specifiers.
1068 GNU C ¥é¥¤¥Ö¥é¥ê (glibc) ¤Ç¤ÏÈóɸ½à¤Î¥ª¥×¥·¥ç¥ó¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤ª¤ê¡¢
1069 ¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»È¤¦¤ÈÊÑ´¹»ØÄê»Ò
1072 \fB%a[\fP\fIrange\fP\fB]\fP
1073 ¤Ø¤ÎÆþÎÏʸ»úÎó¤ËÂФ·¤Æ½½Ê¬¤ÊÂ礤µ¤Îʸ»úÎó¤ò¥é¥¤¥Ö¥é¥ê¤¬Æ°Åª¤Ë³ÎÊݤ¹¤ë
1075 .\"O .\" This feature seems to be present at least as far back as glibc 2.0.
1076 .\" ¤³¤Îµ¡Ç½¤Ï¾¯¤Ê¤¯¤È¤â glibc 2.0 »þÅÀ¤«¤é¸ºß¤·¤Æ¤¤¤ë¤è¤¦¤À¡£
1077 .\"O To make use of this feature, specify
1079 .\"O as a length modifier (thus
1082 .\"O \fB%a[\fP\fIrange\fP\fB]\fP).
1083 .\"O The caller must
1085 .\"O the returned string, as in the following example:
1086 ¤³¤Îµ¡Ç½¤ò»ÈÍѤ¹¤ë¤Ë¤Ï¡¢Ä¹¤µ½¤¾þ»Ò¤È¤·¤Æ
1088 ¤ò»ØÄꤹ¤ë (¤·¤¿¤¬¤Ã¤Æ¡¢Á´ÂΤȤ·¤Æ¤Ï
1091 \fB%a[\fP\fIrange\fP\fB]\fP ¤È¤Ê¤ë)¡£
1092 °Ê²¼¤ÎÎã¤Ë¤¢¤ë¤è¤¦¤Ë¡¢¸Æ¤Ó½Ð¤·Â¦¤ÏÊÖ¤µ¤ì¤¿Ê¸»úÎó¤ò
1094 ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
1102 n = scanf("%a[a-z]", &p);
1104 printf("read: %s\\n", p);
1106 } else if (errno != 0) {
1109 fprintf(stderr, "No matching characters\\n"):
1114 .\"O As shown in the above example, it is only necessary to call
1118 .\"O call successfully read a string.
1119 ¾åµ¤ÎÎã¤Ë¤¢¤ë¤è¤¦¤Ë¡¢
1121 ¤¬Ê¸»úÎó¤ÎÆɤ߹þ¤ß¤ËÀ®¸ù¤·¤¿¾ì¹ç¤Ë¤À¤±¡¢
1123 ¤ò¸Æ¤Ó½Ð¤¹É¬Íפ¬¤¢¤ë¡£
1127 .\"O modifier is not available if the program is compiled with
1128 .\"O .I "gcc -std=c99"
1130 .\"O .IR "gcc -D_ISOC99_SOURCE"
1133 .\"O is also specified), in which case the
1135 .\"O is interpreted as a specifier for floating-point numbers (see above).
1138 .I "gcc -D_ISOC99_SOURCE"
1139 ¤Ç¥³¥ó¥Ñ¥¤¥ë¤·¤¿¥×¥í¥°¥é¥à¤Ç¤Ï
1141 ¤âƱ»þ¤Ë»ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç)¡¢
1143 ½¤¾þ»Ò¤ÏÍøÍѤǤ¤Ê¤¤¡£
1146 ¤Ï (¾å½Ò¤ÎÄ̤ê) ÉâÆ°¾®¿ôÅÀ¿ô¤ò¼¨¤¹ÊÑ´¹»ØÄê»Ò¤È²ò¼á¤µ¤ì¤ë¡£
1148 .\"O Since version 2.7, glibc also provides the
1150 .\"O modifier for the same purpose as the
1155 .\"O modifier has the following advantages:
1156 ¥Ð¡¼¥¸¥ç¥ó 2.7 °Ê¹ß¤Ç¤Ï¡¢glibc ¤Ï
1160 ½¤¾þ»Ò¤âÄ󶡤·¤Æ¤¤¤ë¡£
1162 ½¤¾þ»Ò¤Ï°Ê²¼¤ÎÍøÅÀ¤¬¤¢¤ë¡£
1164 .\"O It may also be applied to
1166 .\"O conversion specifiers (e.g.,
1169 ÊÑ´¹»ØÄê»Ò¤Ë¤âŬÍѤǤ¤ë (Î㤨¤Ð
1172 .\"O It avoids ambiguity with respect to the
1174 .\"O floating-point conversion specifier (and is unaffected by
1175 .\"O .IR "gcc -std=c99"
1177 ÉâÆ°¾®¿ôÅÀÊÑ´¹»ØÄê»Ò¤È¤·¤Æ¤Î
1179 ¤È¤Îʶ¤é¤ï¤·¤µ¤¬Èò¤±¤é¤ì¤ë (¤Þ¤¿
1181 ¤Ê¤É¤Î±Æ¶Á¤âÈò¤±¤é¤ì¤ë)¡£
1183 .\"O It is specified in the upcoming revision of the POSIX.1 standard.
1184 POSIX.1 ɸ½à¤Î¼¡¤Î²þÄûÈǤǵ¬Äꤵ¤ì¤ë¡£
1187 .\"O All functions are fully C89 conformant, but provide the
1188 .\"O additional specifiers
1192 .\"O as well as an additional behavior of the
1197 .\"O The latter may be considered to be a bug, as it changes the
1198 .\"O behavior of specifiers defined in C89.
1199 Á´¤Æ¤Î´Ø¿ô¤Ï¡¢´°Á´¤Ë C89 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£¤·¤«¤·
1204 »ØÄê»Ò¤¬Ä󶡤µ¤ì¤Æ¤ª¤ê¡¢Æ±ÍͤË
1208 »ØÄê»Ò¤ÎÉÕ²ÃŪ¤Ê¿¶¤ëÉñ¤¤¤â¤¢¤ë¡£¸å¼Ô¤Ï¡¢
1209 C89 ¤ÇÄêµÁ¤µ¤ì¤¿»ØÄê»Ò¤Î¿¶¤ëÉñ¤¤¤òÊѹ¹¤¹¤ë¤â¤Î¤Ê¤Î¤Ç¡¢
1210 ¥Ð¥°¤È¤ß¤Ê¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
1212 .\"O Some combinations of the type modifiers and conversion
1213 .\"O specifiers defined by ANSI C do not make sense
1216 ANSI C ¤ÇÄêµÁ¤µ¤ì¤¿·¿½¤¾þ»Ò¤ÈÊÑ´¹»ØÄê»Ò¤ÎÁȤ߹ç¤ï¤»¤ÎÃæ¤Ë¤Ï
1217 °ÕÌ£¤ò¤Ê¤µ¤Ê¤¤¤â¤Î¤¬¤¢¤ë
1220 .\"O While they may have a well-defined behavior on Linux, this need not
1221 .\"O to be so on other architectures.
1222 .\"O Therefore it usually is better to use
1223 .\"O modifiers that are not defined by ANSI C at all, that is, use
1227 .\"O in combination with
1228 .\"O \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, \fBx\fP, and \fBX\fP
1231 ¤³¤ì¤é¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
1232 Linux ¾å¤Ç¤Ï¤Ï¤Ã¤¤ê¤ÈÄêµÁ¤µ¤ì¤¿¿¶¤ëÉñ¤¤¤ò¤¹¤ë¤«¤â¤·¤ì¤Ê¤¤¤¬¡¢
1233 ¾¤Î¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Ç¤âƱÍͤˤʤäƤ¤¤ë¤È¤Ï¸Â¤é¤Ê¤¤¡£
1234 ¤½¤ì¤æ¤¨¤Ë¡¢¤Û¤È¤ó¤É¤Î¾ì¹ç¡¢
1235 ANSI C ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤½¤¾þ»Ò¤ò»ÈÍѤ·¤¿Êý¤¬Îɤ¤¡£
1237 \fBd\fP, \fBi\fP, \fBo\fP, \fBu\fP, \fBx\fP, \fBX\fP
1240 ¤ÈÁȤ߹ç¤ï¤»¤ë¾ì¹ç¤Ë¤Ï¡¢
1244 ¤ò»ÈÍѤ·¤¿Êý¤¬Îɤ¤¡£
1248 .\"O is not the same as on 4.4BSD,
1249 .\"O as it may be used in float conversions equivalently to
1252 ¤Î»ÈÍÑÊýË¡¤Ï 4.4BSD ¤ÈƱ¤¸¤Ç¤Ï¤Ê¤¤¡£
1257 ¤ÈƱÅù¤ËÉâÆ°¾®¿ô¤ÎÊÑ´¹¤Ë»ÈÍѤµ¤ì¤ë¡£