OSDN Git Service

c71e040676fa155422d3d698d173a22496608e32
[linuxjm/LDP_man-pages.git] / release / man3 / strtoul.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sun Jul 25 10:54:03 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Fixed typo, aeb, 950823
29 .\" 2002-02-22, joey, mihtjel: Added strtoull()
30 .\"
31 .\" Japanese Version Copyright (c) 1999 AKAMATSU, Kazuo
32 .\"                            and 2006 Akihiro MOTOKI
33 .\"         all rights reserved.
34 .\" Translated Thu Jan 31 18:00:00 JST 1999
35 .\"         by AKAMATSU, Kazuo
36 .\" Updated & Modified 2006-07-20,
37 .\"         Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
38 .\"
39 .\" WORD:       base            ´ð¿ô
40 .\"
41 .TH STRTOUL 3  2007-07-26 "GNU" "Linux Programmer's Manual"
42 .SH Ì¾Á°
43 strtoul, strtoull, strtouq \- Ê¸»úÎó¤ò unsigned long int ¤ËÊÑ´¹¤¹¤ë
44 .SH ½ñ¼°
45 .nf
46 .B #include <stdlib.h>
47 .sp
48 .BI "unsigned long int strtoul(const char *" nptr ", char **" endptr \
49 ", int " base );
50 .sp
51 .BI "unsigned long long int strtoull(const char *" nptr ", char **" endptr ,
52 .BI "                                int " base );
53 .fi
54 .sp
55 .in -4n
56 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
57 .RB ( feature_test_macros (7)
58 »²¾È):
59 .in
60 .sp
61 .ad l
62 .BR strtoull ():
63 XOPEN_SOURCE >= 600 || _BSD_SOURCE || _SVID_SOURCE || _ISOC99_SOURCE; or
64 .I cc\ -std=c99
65 .ad b
66 .SH ÀâÌÀ
67 .BR strtoul ()
68 ´Ø¿ô¤Ï¡¢ \fInptr\fP ¤Îʸ»úÎó¤ÎºÇ½é¤ÎÉôʬ¤ò¡¢
69 \fIbase\fP ¤ò´ð¿ô¤È¤·¤Æ
70 .I "unsigned long int"
71 ¤ËÊÑ´¹¤¹¤ë¡£
72 ¤³¤Î \fIbase\fP ¤Ï 2 ¤«¤é 36 ¤Þ¤Ç¤ÎÃÍ
73 ¤¢¤ë¤¤¤ÏÆÃÊ̤ʰÕÌ£¤ò»ý¤ÄÃÍ 0 ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
74 .PP
75 ʸ»úÎó¤ÎÀèƬ¤Ë¤Ï¡¢Ç¤°Õ¤Î¿ô¤Î¶õÇò¤¬¤¢¤Ã¤Æ¤â¤è¤¯ (¶õÇò¤Ï
76 .BR ( isspace (3)
77 ¤ÇȽÄꤵ¤ì¤ë) ¡¢¤Þ¤¿¿ô»ú¤ÎľÁ°¤Ë¤Ï \(aq+\(aq ¤« \(aq\-\(aq ¤Î
78 Éä¹æ¤¬¤¢¤Ã¤Æ¤â¤è¤¤¡£
79 \fIbase\fP ¤¬ 0 ¤Þ¤¿¤Ï 16 ¤Î¾ì¹ç¤Ë¤Ï¡¢ Ê¸»úÎó¤ÎÀèƬ¤Ë "0x" ¤òÃÖ¤¯¤³¤È¤¬
80 ¤Ç¤­¡¢¤½¤Î¾ì¹ç¤Ë¤Ïʸ»úÎó¤Ï 16¿Ê¿ô¤È¤·¤Æ°·¤ï¤ì¤ë¡£
81 ¤³¤ì°Ê³°¤Îʸ»úÎó¤Ç \fIbase\fP ¤¬ 0 ¤Î¾ì¹ç¤Ï¡¢
82 ʸ»úÎ󤬠\(aq0\(aq ¤Ç»Ï¤Þ¤ë¤È¤­¤Ï 8¿Ê¿ô¤È¤·¤Æ¡¢
83 ¤½¤ì°Ê³°¤Î¤È¤­¤Ï 10¿Ê¿ô¤È¤·¤Æ°·¤ï¤ì¤ë¡£
84 .PP
85 ʸ»úÎó¤Î»Ä¤ê¤ÎÉôʬ¤Ï
86 .I "unsigned long int"
87 ¤ËÊÑ´¹¤µ¤ì¤ë¤¬¡¢´ð¿ô¤ËÂФ·¤Æ
88 Í­¸ú¤Ç¤Ê¤¤¿ô»ú¤¬¸½¤ì¤¿»þÅÀ¤ÇÊÑ´¹¤Ï½ªÎ»¤¹¤ë¡£(11¿Ê¿ô°Ê¾å¤Ç¤Ï \(aqA\(aq ¤Ï
89 Âçʸ»ú¡¦¾®Ê¸»ú¤Ë´Ø¤ï¤é¤º 10 ¤òɽ¤·¡¢ \(aqB\(aq ¤Ï 11 ¤òɽ¸½¤·,
90 °Ê²¼Æ±Íͤˡ¢ \(aqZ\(aq ¤Ï 35 ¤òɽ¤¹¡£)
91 .PP
92 \fIendptr\fP ¤¬¥Ì¥ëÃÍ (NULL) ¤Ç¤Ê¤¤¾ì¹ç¡¢
93 .BR strtoul ()
94 ¤ÏºÇ½é¤ËÉÔÀµ¤Êʸ»ú¤¬¸½¤ì¤¿¥¢¥É¥ì¥¹¤ò
95 \fI*endptr\fP ¤Ë³ÊǼ¤·¤Æ¤¤¤ë¡£
96 ʸ»úÎó¤ËÍ­¸ú¤Ê¿ô»ú¤¬¤Ò¤È¤Ä¤â¤Ê¤±¤ì¤Ð¡¢
97 .BR strtoul ()
98 ¤Ï \fInptr\fP
99 ¤Î¸µ¤ÎÃͤò \fI*endptr\fP ¤ËÂåÆþ¤¹¤ë(¤½¤·¤Æ 0 ¤òÊÖ¤¹)¡£
100 Æäˡ¢ \fI*nptr\fP ¤¬ \(aq\\0\(aq °Ê³°¤Ç¡¢ÊÖ¤µ¤ì¤¿ \fI**endptr\fP ¤¬
101 \(aq\\0\(aq ¤Ê¤é¤Ð¡¢Ê¸»úÎóÁ´ÂΤ¬Í­¸ú¤À¤Ã¤¿¤³¤È¤Ë¤Ê¤ë¡£
102 .PP
103 .BR strtoull ()
104 ´Ø¿ô¤Ï
105 .BR strtoul ()
106 ´Ø¿ô¤ÈƱÍͤÀ¤¬¡¢
107 .I "unsigned long long int"
108 ·¿¤ÎÃͤòÊÖ¤¹¡£
109 .SH ÊÖ¤êÃÍ
110 .BR strtoul ()
111 ´Ø¿ô¤ÏÊÑ´¹·ë²Ì¤òÊÖ¤¹¡£Ê¸»úÎ󤬥ޥ¤¥Ê¥¹Éä¹æ¤«¤é»Ï¤Þ¤Ã¤Æ¤¤¤¿¾ì
112 ¹ç¤Ï¡¢(Éä¹æȿžÁ°¤ÎÃͤ¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Æ¤¤¤Ê¤±¤ì¤Ð) ÊÑ´¹·ë²Ì¤òÉä¹æȿž¤·¤¿
113 Ãͤò unsigned ·¿¤ÇÊÖ¤¹¡£ÊÑ´¹¤Ç¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ï
114 .B ULONG_MAX
115 ¤òÊÖ¤·¡¢
116 .I errno
117 ¤Ë
118 .B ERANGE
119 ¤òÀßÄꤹ¤ë¡£
120 .RB ( ULONG_MAX
121 ¤ò
122 .B ULLONG_MAX
123 ¤ÈÆɤßÂؤ¨¤ì¤Ð)
124 .BR strtoull ()
125 ¤Ï
126 .BR strtoul ()
127 ¤ÈÁ´¤¯Æ±¤¸¤Ç¤¢¤ë¡£
128 .SH ¥¨¥é¡¼
129 .TP
130 .B EINVAL
131 (C99 ¤Ë¤Ï¤Ê¤¤)
132 Í¿¤¨¤é¤ì¤¿
133 .I base
134 ¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ÃͤǤ¢¤ë¡£
135 .TP
136 .B ERANGE
137 ʸ»úÎ󤬿ôÃͤÎɽ¸½Èϰϳ°¤Ç¤¢¤ë¡£
138 .LP
139 ¼ÂÁõ¤Ë¤è¤Ã¤Æ¤Ï¡¢Á´¤¯ÊÑ´¹¤¬¹Ô¤ï¤ì¤Ê¤«¤Ã¤¿¾ì¹ç(Á´¤¯¿ô»ú¤¬¸½¤ì¤º¡¢
140 0 ¤¬ÊÖ¤µ¤ì¤ë)¡¢\fIerrno\fP ¤Ë \fBEINVAL\fP ¤¬¥»¥Ã¥È¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
141 .SH ½àµò
142 .BR strtoul ()
143 ¤Ï SVr4, C89, C99 ¤È POSIX-2001 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
144 .BR strtoull ()
145 ¤Ï C99 ¤È POSIX.1-2001 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
146 .SH Ãí°Õ
147 .B strtoul ()
148 ¤«¤é¤ÏÀ®¸ù¡¢¼ºÇԤɤÁ¤é¤Î¾ì¹ç¤Ç¤â 0 ¤ä
149 .B LONG_MAX
150 .RB ( strtoull ()
151 ¤Ç¤Ï
152 .BR LLONG_MAX )
153 ¤¬ÊÖ¤ë²ÄǽÀ­¤¬¤¢¤ë¤Î¤Ç¡¢
154 ¥×¥í¥°¥é¥à¤Ï´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹Á°¤Ë
155 .I errno
156 ¤ò 0 ¤ËÀßÄꤷ¡¢¸Æ¤Ó½Ð¤·¸å¤Ë
157 .I errno
158 ¤¬ 0 °Ê³°¤ÎÃͤ«¤É¤¦¤«¤ò³Îǧ¤·¥¨¥é¡¼¤¬È¯À¸¤·¤¿¤«¤É¤¦¤«¤òȽÃǤ¹¤ë
159 ɬÍפ¬¤¢¤ë¡£
160
161 "C" °Ê³°¤Î¥í¥±¡¼¥ë¤Î¾ì¹ç¡¢¤½¤Î¾¤Îʸ»úÎó¤â¼õ¤±ÉÕ¤±¤é¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
162 (Î㤨¤Ð¡¢¸½ºß¤Î¥í¥±¡¼¥ë¤Î 1000 Ëè¤Î¶èÀÚ¤êʸ»ú¤ËÂбþ¤·¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£)
163 .LP
164 BSD ¤Ë¤Ï¡¢
165 .sp
166 .in +4n
167 .nf
168 .BI "u_quad_t strtouq(const char *" nptr ", char **" endptr ", int " base );
169 .sp
170 .in -4n
171 .fi
172 ¤È¤¤¤¦´°Á´¤ËƱÍͤÎÄêµÁ¤ò»ý¤Ä´Ø¿ô¤¬¤¢¤ë¡£
173 »ÈÍÑÃæ¤Î¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Î¥ï¡¼¥ÉĹ¼¡Âè¤Ç¤¢¤ë¤¬¡¢¤³¤Î´Ø¿ô¤Ï
174 .BR strtoull ()
175 ¤ä
176 .BR stroul ()
177 ¤ÈÅù²Á¤Ê¾ì¹ç¤â¤¢¤ê¤¨¤ë¡£
178
179 Éé¤ÎÃͤâÀµÅö¤ÊÆþÎϤȤߤʤµ¤ì¡¢¥¨¥é¡¼¤â¤Ê¤¯¡¢
180 Âбþ¤¹¤ë
181 .I "unsigned long int"
182 ·¿¤ÎÃͤËÊÑ´¹¤µ¤ì¤ë¡£
183 .SH Îã
184 .BR strtol (3)
185 ¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤ÎÎã¤ò»²¾È¡£
186 ¤³¤Î¥Ú¡¼¥¸¤ÇÀâÌÀ¤·¤¿´Ø¿ô¤Î»ÈÍÑÊýË¡¤âƱÍͤǤ¢¤ë¡£
187 .SH ´ØÏ¢¹àÌÜ
188 .BR atof (3),
189 .BR atoi (3),
190 .BR atol (3),
191 .BR strtod (3),
192 .BR strtol (3)