Scroll to navigation

asprintf(3) Library Functions Manual asprintf(3)

NOMBRE

asprintf, vasprintf - imprimen en una cadena reservada

BIBLIOTECA

Biblioteca Estándar C (libc, -lc)

SINOPSIS

#define _GNU_SOURCE         /* Vea feature_test_macros(7) */
#include <stdio.h>
int asprintf(char **restrict strp, const char *restrict fmt, ...);
int vasprintf(char **restrict strp, const char *restrict fmt,
              va_list ap);

DESCRIPCIÓN

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.

VALOR DEVUELTO

Cuando tienen éxito, estas funciones devuelven el número de bytes impresos, al igual que 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 strp queda indefinido.

ATRIBUTOS

Para obtener una explicación de los términos usados en esta sección, véase attributes(7).

Interfaz Atributo Valor
asprintf(), vasprintf() Seguridad del hilo Configuración regional de multi-hilo seguro

VERSIONES

The FreeBSD implementation sets strp to NULL on error.

ESTÁNDARES

GNU, BSD.

VÉASE TAMBIÉN

free(3), malloc(3), printf(3)

TRADUCCIÓN

La traducción al español de esta página del manual fue creada por Miguel Pérez Ibars <mpi79470@alu.um.es>

Esta traducción es documentación libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD.

Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a debian-l10n-spanish@lists.debian.org.

20 ​​Julio 2023 Páginas de manual de Linux 6.05.01