1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Text fragments inspired by Martin Schulze <joey@infodrom.org>.
27 .TH ASPRINTF 3 2013-06-21 "GNU" "Linux Programmer's Manual"
29 asprintf, vasprintf \- print to allocated string
31 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
35 .BI "int asprintf(char **" strp ", const char *" fmt ", ...);"
37 .BI "int vasprintf(char **" strp ", const char *" fmt ", va_list " ap );
47 except that they allocate a string large enough to hold the output
48 including the terminating null byte (\(aq\\0\(aq),
49 and return a pointer to it via the first argument.
50 This pointer should be passed to
52 to release the allocated storage when it is no longer needed.
54 When successful, these functions return the number of bytes printed,
57 If memory allocation wasn't possible, or some other error occurs,
58 these functions will return \-1, and the contents of
62 These functions are GNU extensions, not in C or POSIX.
63 They are also available under *BSD.
64 The FreeBSD implementation sets