.\" Copyright (C) 2001 Andries Brouwer .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" Text fragments inspired by Martin Schulze . .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH ASPRINTF 3 2001\-12\-18 GNU "Linux Programmer's Manual" .SH 名前 asprintf, vasprintf \- 文字列を割り当ててそれに出力する .SH 書式 \fB#define _GNU_SOURCE\fP /* feature_test_macros(7) 参照 */ .br \fB#include \fP .sp \fBint asprintf(char **\fP\fIstrp\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP .sp \fBint vasprintf(char **\fP\fIstrp\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIap\fP\fB);\fP .SH 説明 \fBasprintf\fP() 関数と \fBvasprintf\fP() 関数とは、それぞれ \fBsprintf\fP(3) 関数と \fBvsprintf\fP(3) 関数とに似ているが、 出力文字列を (終端の NULL バイトも含めて) 保持するのに十分な大きさのメモリを確保し、 最初の引数にその文字列へのポインタを返す。 このポインタは、不要になったら \fBfree\fP(3) に渡し、割り当てられた記憶領域を解放すべきである。 .SH 返り値 成功すると、これらの関数は出力されたバイト数を (\fBsprintf\fP(3) のように) 返す。 メモリの割り当てができなかったり、 その他エラーが生じると、 これらの関数は \-1 を返し、 \fIstrp\fP の内容は未定義となる。 .SH 準拠 これらの関数は GNU の拡張であり、C や POSIX のものではない。 これらは *BSD でも利用できる。 FreeBSD の実装では、エラーの際には \fIstrp\fP を NULL にセットする。 .SH 関連項目 \fBfree\fP(3), \fBmalloc\fP(3), \fBprintf\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。