asprintf function

in #security10 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.04
TRX 0.32
JST 0.083
BTC 60710.55
ETH 1561.14
USDT 1.00
SBD 0.47