OSDN Git Service

(split) LDP: draft snapshot generated from latest pthread/ja.po files.
[linuxjm/LDP_man-pages.git] / release / man3 / stpcpy.3
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
4 .\"
5 .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
6 .\"     all rights reserved.
7 .\" Translated Fri Dec 26 13:14:47 JST 1997
8 .\"     by HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
9 .\"
10 .\" Permission is granted to make and distribute verbatim copies of this
11 .\" manual provided the copyright notice and this permission notice are
12 .\" preserved on all copies.
13 .\"
14 .\" Permission is granted to copy and distribute modified versions of this
15 .\" manual under the conditions for verbatim copying, provided that the
16 .\" entire resulting derived work is distributed under the terms of a
17 .\" permission notice identical to this one.
18 .\"
19 .\" Since the Linux kernel and libraries are constantly changing, this
20 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
21 .\" responsibility for errors or omissions, or for damages resulting from
22 .\" the use of the information contained herein.  The author(s) may not
23 .\" have taken the same level of care in the production of this manual,
24 .\" which is licensed free of charge, as they might when working
25 .\" professionally.
26 .\"
27 .\" Formatted or processed versions of this manual, if unaccompanied by
28 .\" the source, must acknowledge the copyright and authors of this work.
29 .\"
30 .TH STPCPY 3  2011-09-28 "GNU" "Linux Programmer's Manual"
31 .SH 名前
32 stpcpy \- 文字列をコピーし、コピーした文字列の終りへのポインタを返す
33 .SH 書式
34 .nf
35 .B #include <string.h>
36 .sp
37 .BI "char *stpcpy(char *" dest ", const char *" src );
38 .fi
39 .sp
40 .in -4n
41 glibc 向けの機能検査マクロの要件
42 .RB ( feature_test_macros (7)
43 参照):
44 .in
45 .sp
46 .BR stpcpy ():
47 .PD 0
48 .ad l
49 .RS 4
50 .TP 4
51 glibc 2.10 以降:
52 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
53 .TP
54 glibc 2.10 より前:
55 _GNU_SOURCE
56 .RE
57 .ad
58 .PD
59 .SH 説明
60 .BR stpcpy ()
61 関数は、\fIsrc\fP で指された文字列を (文字列を終端する NULL バイト
62 (\(aq\\0\(aq) を含めて) \fIdest\fP で指された配列にコピーする。
63 文字列は重複してはならず、コピー先の文字列 \fIdest\fP はコピーを受け取る
64 のに十分大きくなくてはならない。
65 .SH 返り値
66 .BR stpcpy ()
67 は、文字列 \fIdest\fP の始まりではなく
68 \fB終り\fPを指すポインタ (すなわち、文字列を終端する NULL バイト) を返す。
69 .SH 準拠
70 この関数は POSIX.1-2008 に追加された。
71 それ以前は、この関数は C や POSIX.1 標準の一部でも
72 UNIX システムの慣習的なものでもなかったが、
73 GNU の発明というわけでもなかった。
74 ひょっとしたら MS-DOS 由来のものかもしれない。
75 この関数は BSD 系にも存在する。
76 .SH 例
77 例として、このプログラムは \fBfoo\fP と \fBbar\fP を連結して \fBfoobar\fP
78 を作るために
79 .BR stpcpy ()
80 を使用し、その後表示する。
81 .in +4n
82 .nf
83
84 #define _GNU_SOURCE
85 #include <string.h>
86 #include <stdio.h>
87
88 int
89 main(void)
90 {
91     char buffer[20];
92     char *to = buffer;
93
94     to = stpcpy(to, "foo");
95     to = stpcpy(to, "bar");
96     printf("%s\\n", buffer);
97 }
98 .fi
99 .in
100 .SH バグ
101 この関数はバッファ
102 .I dest
103 の範囲を行き過ぎてしまう可能性がある。
104 .SH 関連項目
105 .BR bcopy (3),
106 .BR memccpy (3),
107 .BR memcpy (3),
108 .BR memmove (3),
109 .BR stpncpy (3),
110 .BR strcpy (3),
111 .BR string (3),
112 .BR wcpcpy (3)