SysTutorials

Linux Manual Pages › Section 3

asprintf(3)

NAME

asprintf, vasprintf – print to allocated string

SYNOPSIS

#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>

int asprintf(char **strp, const char *fmt, …);

int vasprintf(char **strp, const char *fmt, va_list ap);

DESCRIPTION

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 (‘