aboutsummaryrefslogtreecommitdiff
path: root/documentation/manual-pages/ja/man3/strtol.3
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/manual-pages/ja/man3/strtol.3')
-rw-r--r--documentation/manual-pages/ja/man3/strtol.3200
1 files changed, 200 insertions, 0 deletions
diff --git a/documentation/manual-pages/ja/man3/strtol.3 b/documentation/manual-pages/ja/man3/strtol.3
new file mode 100644
index 0000000000..9127ead26e
--- /dev/null
+++ b/documentation/manual-pages/ja/man3/strtol.3
@@ -0,0 +1,200 @@
+.\" Copyright (c) 1990, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Chris Torek and the American National Standards Committee X3,
+.\" on Information Processing Systems.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)strtol.3 8.1 (Berkeley) 6/4/93
+.\" %FreeBSD: src/lib/libc/stdlib/strtol.3,v 1.4.2.5 2001/12/14 18:33:58 ru Exp %
+.\"
+.\" $FreeBSD$
+.Dd June 4, 1993
+.Dt STRTOL 3
+.Os
+.Sh 名称
+.Nm strtol, strtoq
+.Nd 文字列の数値を long 値、long long 値または quad_t 値に変換
+.Sh ライブラリ
+.Lb libc
+.Sh 書式
+.In stdlib.h
+.In limits.h
+.Ft long
+.Fn strtol "const char *nptr" "char **endptr" "int base"
+.Ft long long
+.Fn strtoll "const char *nptr" "char **endptr" "int base"
+.In sys/types.h
+.In stdlib.h
+.In limits.h
+.Ft quad_t
+.Fn strtoq "const char *nptr" "char **endptr" "int base"
+.Sh 解説
+.Fn strtol
+関数は、
+.Fa nptr
+にある文字列を
+.Em long
+値に変換します。
+.Fn strtoll
+関数は、
+.Fa nptr
+にある文字列を
+.Em long long
+値に変換します。
+.Fn strtoq
+関数は、
+.Fa nptr
+にある文字列を
+.Em quad_t
+値に変換します。
+変換は与えられた
+.Fa base
+に従って行われます。
+この
+.Fa base
+の値は 2 から 36 の間か、
+または特別な値である 0 でなければなりません。
+.Pp
+文字列は、任意の数の空白文字
+.Xr (isspace 3
+により決められるような) で始まり、
+オプションで一つの
+.Ql +
+または
+.Ql -
+記号がそれに続きます。
+.Fa base
+が 0 か 16 のときは、文字列は接頭辞
+.Ql 0x
+を含むことができ、数字は基数を 16 として読み取られます。
+そうでないときの、0 の
+.Fa base
+では、その次の文字が
+.Ql 0
+でなければ
+10 (10 進数) と見なされ、
+.Ql 0
+であれば
+8 (8 進数) と見なされます。
+.Pp
+文字列の残りは、
+与えられた基数では有効な数字ではない最初の文字のところで中止するという
+わかりやすいやり方で
+.Em long
+値に変換されます。
+(10 以上の基数では、大文字または小文字の
+.Ql A
+は 10 を、
+.Ql B
+は 11 を表し、
+.Ql Z
+は 35 を表します。)
+.Pp
+.Fa endptr
+が空ポインタではない場合は、
+.Fn strtol
+は最初の無効な文字のアドレスを
+.Fa *endptr
+に格納します。
+数字が全くなかった場合は、
+.Fn strtol
+は
+.Fa nptr
+の元の値を
+.Fa *endptr
+に格納します。
+(従って、戻ったときに
+.Fa *nptr
+が
+.Ql \e0
+ではなく、
+.Fa **endptr
+が
+.Ql \e0
+である場合は、文字列全体が
+有効だったことになります。)
+.Sh 戻り値
+.Fn strtol
+関数は、値がアンダフローやオーバフローを起こさない限り、
+変換の結果を返します。
+アンダフローが起こった場合は、
+.Fn strtol
+は
+.Dv LONG_MIN
+を返します。オーバフローが起こった場合は、
+.Fn strtol
+は
+.Dv LONG_MAX
+を返します。
+.Fn strtoll
+関数は、値がアンダフローやオーバフローを起こさない限り、
+変換の結果を返します。
+アンダフローが起こった場合は、
+.Fn strtoll
+は
+.Dv LLONG_MIN
+を返します。オーバフローが起こった場合は、
+.Fn strtoll
+は
+.Dv LLONG_MAX
+を返します。
+全ての場合、
+.Va errno
+は
+.Er ERANGE
+に設定されます。
+.Sh エラー
+.Bl -tag -width Er
+.It Bq Er ERANGE
+与えられた文字列が値域を超えました。
+変換された値は固定されています。
+.El
+.Sh 関連項目
+.Xr atof 3 ,
+.Xr atoi 3 ,
+.Xr atol 3 ,
+.Xr strtod 3 ,
+.Xr strtoul 3
+.Sh 規格
+.Fn strtol
+関数は、
+.St -isoC
+に適合しています。
+.Fn strtoll
+関数は、
+.St -isoC-99
+に適合しています。
+.Bx
+.Fn strtoq
+関数は推奨されません。
+.Sh バグ
+現在のロケールを無視します。