Linux Man Pages

Unix Manual Pages Home

Free Linux Documentation

Manual pages sections
Almost all UNIX operating systems have voluminous documentation known as manual pages. Every page is a document. If one wants to read a page then the command man at a shell prompt will show the manual, for example, "man ftp". Pages are referred by using the notation "name(manual-section)", for example time(1).


Man Page :: Unix Man Pages - asprintf
Browse Linux man pages by name. Choose the first letter of the name of the Linux command, function, or file you are interested in:
a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|_| All


NAME

asprintf, vasprintf - print to allocated string

SYNOPSIS

#define _GNU_SOURCE #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, and return a pointer to it via the first parameter. This pointer should be passed to free (3) to release the allocated storage when it is no longer needed.

RETURN VALUE

When successful, these functions return the number of bytes printed, just like sprintf (3). If memory allocation wasn't possible, or some other error occurs, these functions will return -1, and the contents of strp is undefined.

CONFORMING TO

These functions are GNU extensions, not in C or POSIX. They are also available under *BSD. The FreeBSD implementation sets strp to NULL on error.

SEE ALSO

free (3) malloc (3) printf (3) feature_test_macros (7)



Unix / Linux Man Pages
Copyright (C) 2008 istild.com. All Rights Reserved.

Unix / Linux Manual Pages Man Pages Man Pages Online Documentation - Valid CSS!