1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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()
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
41 .TH STRTOUL 3 2007-07-26 "GNU" "Linux Programmer's Manual"
43 strtoul, strtoull, strtouq \- ʸ»úÎó¤ò unsigned long int ¤ËÊÑ´¹¤¹¤ë
46 .B #include <stdlib.h>
48 .BI "unsigned long int strtoul(const char *" nptr ", char **" endptr \
51 .BI "unsigned long long int strtoull(const char *" nptr ", char **" endptr ,
56 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
57 .RB ( feature_test_macros (7)
63 XOPEN_SOURCE >= 600 || _BSD_SOURCE || _SVID_SOURCE || _ISOC99_SOURCE; or
68 ´Ø¿ô¤Ï¡¢ \fInptr\fP ¤Îʸ»úÎó¤ÎºÇ½é¤ÎÉôʬ¤ò¡¢
69 \fIbase\fP ¤ò´ð¿ô¤È¤·¤Æ
70 .I "unsigned long int"
72 ¤³¤Î \fIbase\fP ¤Ï 2 ¤«¤é 36 ¤Þ¤Ç¤ÎÃÍ
73 ¤¢¤ë¤¤¤ÏÆÃÊ̤ʰÕÌ£¤ò»ý¤ÄÃÍ 0 ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
75 ʸ»úÎó¤ÎÀèƬ¤Ë¤Ï¡¢Ç¤°Õ¤Î¿ô¤Î¶õÇò¤¬¤¢¤Ã¤Æ¤â¤è¤¯ (¶õÇò¤Ï
77 ¤ÇȽÄꤵ¤ì¤ë) ¡¢¤Þ¤¿¿ô»ú¤ÎľÁ°¤Ë¤Ï \(aq+\(aq ¤« \(aq\-\(aq ¤Î
79 \fIbase\fP ¤¬ 0 ¤Þ¤¿¤Ï 16 ¤Î¾ì¹ç¤Ë¤Ï¡¢ ʸ»úÎó¤ÎÀèƬ¤Ë "0x" ¤òÃÖ¤¯¤³¤È¤¬
80 ¤Ç¤¡¢¤½¤Î¾ì¹ç¤Ë¤Ïʸ»úÎó¤Ï 16¿Ê¿ô¤È¤·¤Æ°·¤ï¤ì¤ë¡£
81 ¤³¤ì°Ê³°¤Îʸ»úÎó¤Ç \fIbase\fP ¤¬ 0 ¤Î¾ì¹ç¤Ï¡¢
82 ʸ»úÎó¤¬ \(aq0\(aq ¤Ç»Ï¤Þ¤ë¤È¤¤Ï 8¿Ê¿ô¤È¤·¤Æ¡¢
83 ¤½¤ì°Ê³°¤Î¤È¤¤Ï 10¿Ê¿ô¤È¤·¤Æ°·¤ï¤ì¤ë¡£
86 .I "unsigned long int"
87 ¤ËÊÑ´¹¤µ¤ì¤ë¤¬¡¢´ð¿ô¤ËÂФ·¤Æ
88 ͸ú¤Ç¤Ê¤¤¿ô»ú¤¬¸½¤ì¤¿»þÅÀ¤ÇÊÑ´¹¤Ï½ªÎ»¤¹¤ë¡£(11¿Ê¿ô°Ê¾å¤Ç¤Ï \(aqA\(aq ¤Ï
89 Âçʸ»ú¡¦¾®Ê¸»ú¤Ë´Ø¤ï¤é¤º 10 ¤òɽ¤·¡¢ \(aqB\(aq ¤Ï 11 ¤òɽ¸½¤·,
90 °Ê²¼Æ±Íͤˡ¢ \(aqZ\(aq ¤Ï 35 ¤òɽ¤¹¡£)
92 \fIendptr\fP ¤¬¥Ì¥ëÃÍ (NULL) ¤Ç¤Ê¤¤¾ì¹ç¡¢
94 ¤ÏºÇ½é¤ËÉÔÀµ¤Êʸ»ú¤¬¸½¤ì¤¿¥¢¥É¥ì¥¹¤ò
95 \fI*endptr\fP ¤Ë³ÊǼ¤·¤Æ¤¤¤ë¡£
96 ʸ»úÎó¤Ë͸ú¤Ê¿ô»ú¤¬¤Ò¤È¤Ä¤â¤Ê¤±¤ì¤Ð¡¢
99 ¤Î¸µ¤ÎÃͤò \fI*endptr\fP ¤ËÂåÆþ¤¹¤ë(¤½¤·¤Æ 0 ¤òÊÖ¤¹)¡£
100 Æäˡ¢ \fI*nptr\fP ¤¬ \(aq\\0\(aq °Ê³°¤Ç¡¢ÊÖ¤µ¤ì¤¿ \fI**endptr\fP ¤¬
101 \(aq\\0\(aq ¤Ê¤é¤Ð¡¢Ê¸»úÎóÁ´ÂΤ¬Í¸ú¤À¤Ã¤¿¤³¤È¤Ë¤Ê¤ë¡£
107 .I "unsigned long long int"
111 ´Ø¿ô¤ÏÊÑ´¹·ë²Ì¤òÊÖ¤¹¡£Ê¸»úÎ󤬥ޥ¤¥Ê¥¹Éä¹æ¤«¤é»Ï¤Þ¤Ã¤Æ¤¤¤¿¾ì
112 ¹ç¤Ï¡¢(Éä¹æȿžÁ°¤ÎÃͤ¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Æ¤¤¤Ê¤±¤ì¤Ð) ÊÑ´¹·ë²Ì¤òÉä¹æȿž¤·¤¿
113 Ãͤò unsigned ·¿¤ÇÊÖ¤¹¡£ÊÑ´¹¤Ç¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ï
134 ¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ÃͤǤ¢¤ë¡£
137 ʸ»úÎ󤬿ôÃͤÎɽ¸½Èϰϳ°¤Ç¤¢¤ë¡£
139 ¼ÂÁõ¤Ë¤è¤Ã¤Æ¤Ï¡¢Á´¤¯ÊÑ´¹¤¬¹Ô¤ï¤ì¤Ê¤«¤Ã¤¿¾ì¹ç(Á´¤¯¿ô»ú¤¬¸½¤ì¤º¡¢
140 0 ¤¬ÊÖ¤µ¤ì¤ë)¡¢\fIerrno\fP ¤Ë \fBEINVAL\fP ¤¬¥»¥Ã¥È¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
143 ¤Ï SVr4, C89, C99 ¤È POSIX-2001 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
145 ¤Ï C99 ¤È POSIX.1-2001 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
148 ¤«¤é¤ÏÀ®¸ù¡¢¼ºÇԤɤÁ¤é¤Î¾ì¹ç¤Ç¤â 0 ¤ä
153 ¤¬ÊÖ¤ë²ÄǽÀ¤¬¤¢¤ë¤Î¤Ç¡¢
154 ¥×¥í¥°¥é¥à¤Ï´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹Á°¤Ë
156 ¤ò 0 ¤ËÀßÄꤷ¡¢¸Æ¤Ó½Ð¤·¸å¤Ë
158 ¤¬ 0 °Ê³°¤ÎÃͤ«¤É¤¦¤«¤ò³Îǧ¤·¥¨¥é¡¼¤¬È¯À¸¤·¤¿¤«¤É¤¦¤«¤òȽÃǤ¹¤ë
161 "C" °Ê³°¤Î¥í¥±¡¼¥ë¤Î¾ì¹ç¡¢¤½¤Î¾¤Îʸ»úÎó¤â¼õ¤±ÉÕ¤±¤é¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
162 (Î㤨¤Ð¡¢¸½ºß¤Î¥í¥±¡¼¥ë¤Î 1000 Ëè¤Î¶èÀÚ¤êʸ»ú¤ËÂбþ¤·¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£)
168 .BI "u_quad_t strtouq(const char *" nptr ", char **" endptr ", int " base );
172 ¤È¤¤¤¦´°Á´¤ËƱÍͤÎÄêµÁ¤ò»ý¤Ä´Ø¿ô¤¬¤¢¤ë¡£
173 »ÈÍÑÃæ¤Î¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Î¥ï¡¼¥ÉĹ¼¡Âè¤Ç¤¢¤ë¤¬¡¢¤³¤Î´Ø¿ô¤Ï
177 ¤ÈÅù²Á¤Ê¾ì¹ç¤â¤¢¤ê¤¨¤ë¡£
179 Éé¤ÎÃͤâÀµÅö¤ÊÆþÎϤȤߤʤµ¤ì¡¢¥¨¥é¡¼¤â¤Ê¤¯¡¢
181 .I "unsigned long int"
185 ¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤ÎÎã¤ò»²¾È¡£
186 ¤³¤Î¥Ú¡¼¥¸¤ÇÀâÌÀ¤·¤¿´Ø¿ô¤Î»ÈÍÑÊýË¡¤âƱÍͤǤ¢¤ë¡£