.\" 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 . .\" .\" Traducido por Miguel Pérez Ibars el 10-julio-2004 .\" .TH ASPRINTF 3 "18 diciembre 2001" "GNU" "Manual del Programador de Linux" .SH NOMBRE asprintf, vasprintf \- imprimen en una cadena reservada .SH SINOPSIS .B #define _GNU_SOURCE .br .B #include .sp .BI "int asprintf(char **" strp ", const char *" fmt ", ...);" .sp .BI "int vasprintf(char **" strp ", const char *" fmt ", va_list " ap ); .SH DESCRIPCIÓN Las funciones .B asprintf y .B vasprintf son análogas a .B sprintf y .BR vsprintf , salvo porque reservan una cadena lo suficientemente grande para almacenar la salida incluyendo el carácter NUL del final, y devuelven un puntero a ella a través del primer parámetro. Este puntero debe ser pasado a .BR free (3) para liberar la memoria asignada cuando ya no se necesite. .SH "VALOR DEVUELTO" Cuando tienen éxito, estas funciones devuelven el número de bytes impresos, al igual que .BR sprintf (3). Si la reserva de memoria no se pudo llevar a cabo, o ocurre algun otro error, estas funciones devuelven \-1, y el contenido de .I strp queda indefinido. .SH OBSERVACIONES Estas funciones son extensiones de GNU, no están disponibles ni en C ni en POSIX. También están disponibles bajo *BSD. La implementación de FreeBSD asigna a .I strp el valor NULL en caso de error. .SH "VÉASE TAMBIÉN" .BR free (3), .BR malloc (3), .BR printf (3)