OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man3 / asprintf.3
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
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 .\" Text fragments inspired by Martin Schulze <joey@infodrom.org>.
24 .\"
25 .\" Japanese Version Copyright (c) 2002 NAKANO Takeo all rights reserved.
26 .\" Translated Mon 14 Jan 2002 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
27 .\"
28 .TH ASPRINTF 3 2001-12-18 "GNU" "Linux Programmer's Manual"
29 .\"O .SH NAME
30 .\"O asprintf, vasprintf \- print to allocated string
31 .SH Ì¾Á°
32 asprintf, vasprintf \- Ê¸»úÎó¤ò³ä¤êÅö¤Æ¤Æ¤½¤ì¤Ë½ÐÎϤ¹¤ë
33 .\"O .SH SYNOPSIS
34 .SH ½ñ¼°
35 .\"O .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
36 .BR "#define _GNU_SOURCE" "         /* feature_test_macros(7) »²¾È */"
37 .br
38 .B #include <stdio.h>
39 .sp
40 .BI "int asprintf(char **" strp ", const char *" fmt ", ...);"
41 .sp
42 .BI "int vasprintf(char **" strp ", const char *" fmt ", va_list " ap );
43 .\"O .SH DESCRIPTION
44 .SH ÀâÌÀ
45 .\"O The functions
46 .\"O .BR asprintf ()
47 .\"O and
48 .\"O .BR vasprintf ()
49 .\"O are analogs of
50 .\"O .BR sprintf (3)
51 .\"O and
52 .\"O .BR vsprintf (3),
53 .\"O except that they allocate a string large enough to hold the output
54 .\"O including the terminating null byte,
55 .\"O and return a pointer to it via the first argument.
56 .\"O This pointer should be passed to
57 .\"O .BR free (3)
58 .\"O to release the allocated storage when it is no longer needed.
59 .BR asprintf ()
60 ´Ø¿ô¤È
61 .BR vasprintf ()
62 ´Ø¿ô¤È¤Ï¡¢¤½¤ì¤¾¤ì
63 .BR sprintf (3)
64 ´Ø¿ô¤È
65 .BR vsprintf (3)
66 ´Ø¿ô¤È¤Ë»÷¤Æ¤¤¤ë¤¬¡¢
67 ½ÐÎÏʸ»úÎó¤ò (½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤â´Þ¤á¤Æ)
68 ÊÝ»ý¤¹¤ë¤Î¤Ë½½Ê¬¤ÊÂ礭¤µ¤Î¥á¥â¥ê¤ò³ÎÊݤ·¡¢
69 ºÇ½é¤Î°ú¿ô¤Ë¤½¤Îʸ»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
70 ¤³¤Î¥Ý¥¤¥ó¥¿¤Ï¡¢ÉÔÍפˤʤ俤é
71 .BR free (3)
72 ¤ËÅϤ·¡¢³ä¤êÅö¤Æ¤é¤ì¤¿µ­²±Îΰè¤ò²òÊü¤¹¤Ù¤­¤Ç¤¢¤ë¡£
73 .\"O .SH "RETURN VALUE"
74 .SH ÊÖ¤êÃÍ
75 .\"O When successful, these functions return the number of bytes printed,
76 .\"O just like
77 .\"O .BR sprintf (3).
78 .\"O If memory allocation wasn't possible, or some other error occurs,
79 .\"O these functions will return \-1, and the contents of
80 .\"O .I strp
81 .\"O is undefined.
82 À®¸ù¤¹¤ë¤È¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï½ÐÎϤµ¤ì¤¿¥Ð¥¤¥È¿ô¤ò
83 .RB ( sprintf (3)
84 ¤Î¤è¤¦¤Ë) ÊÖ¤¹¡£
85 ¥á¥â¥ê¤Î³ä¤êÅö¤Æ¤¬¤Ç¤­¤Ê¤«¤Ã¤¿¤ê¡¢
86 ¤½¤Î¾¥¨¥é¡¼¤¬À¸¤¸¤ë¤È¡¢
87 ¤³¤ì¤é¤Î´Ø¿ô¤Ï \-1 ¤òÊÖ¤·¡¢
88 .I strp
89 ¤ÎÆâÍƤÏ̤ÄêµÁ¤È¤Ê¤ë¡£
90 .\"O .SH CONFORMING TO
91 .SH ½àµò
92 .\"O These functions are GNU extensions, not in C or POSIX.
93 .\"O They are also available under *BSD.
94 .\"O The FreeBSD implementation sets
95 .\"O .I strp
96 .\"O to NULL on error.
97 ¤³¤ì¤é¤Î´Ø¿ô¤Ï GNU ¤Î³ÈÄ¥¤Ç¤¢¤ê¡¢C ¤ä POSIX ¤Î¤â¤Î¤Ç¤Ï¤Ê¤¤¡£
98 ¤³¤ì¤é¤Ï *BSD ¤Ç¤âÍøÍѤǤ­¤ë¡£
99 FreeBSD ¤Î¼ÂÁõ¤Ç¤Ï¡¢¥¨¥é¡¼¤ÎºÝ¤Ë¤Ï
100 .I strp
101 ¤ò NULL ¤Ë¥»¥Ã¥È¤¹¤ë¡£
102 .\"O .SH "SEE ALSO"
103 .SH ´ØÏ¢¹àÌÜ
104 .BR free (3),
105 .BR malloc (3),
106 .BR printf (3)