asprintf function

in #security8 years ago

□ allocated string printf
□ It is function of GNU extensions(No C or POSIX)
□ int asprintf(char **strp, const char *fmt, ...)
□ It prints the contents of fmt to the strp. As much as the fmt+null's size, a memory is allocated to the strp. Later additionally, memory release is needed.
□ When successful, it returns the number of characters printed. When an error occurs, It returns -1.

□ Example : This stores the string "This sis infosec" in the buffer
char *buffer;
asprintf(&buffer, "This is %s", "INFOSEC");

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.029
BTC 57893.29
ETH 3130.56
USDT 1.00
SBD 2.44