asprintf(3) Library Functions Manual asprintf(3) asprintf, vasprintf - , C (libc, -lc) #define _GNU_SOURCE /* . feature_test_macros(7) */ #include int asprintf(char **restrict strp, const char *restrict fmt, ...); int vasprintf(char **restrict strp, const char *restrict fmt, va_list ap); The functions asprintf() and vasprintf() are analogs of sprintf(3) and vsprintf(3), except that they allocate a string large enough to hold the output including the terminating null byte ('\0'), and return a pointer to it via the first argument. This pointer should be passed to free(3) to release the allocated storage when it is no longer needed. , sprintf(3), . - , -1. strp . attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |asprintf(), vasprintf() | | MT-Safe locale | +----------------------------+----------------------------------------------------------+--------------------------+ The FreeBSD implementation sets strp to NULL on error. GNU, BSD. free(3), malloc(3), printf(3) () Dmitry Bolkhovskikh Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.9.1 15 2024 . asprintf(3)