asprintf.c icon indicating copy to clipboard operation
asprintf.c copied to clipboard

asprintf() implementation

asprintf.c

asprintf() implementation

Install

$ clib install littlstar/asprintf.c

Usage

#include <asprintf.h>

or

#include <asprintf/asprintf.h>

Example


char *str = NULL;
char *fmt = "this is a %s";
int size = asprintf(&str, fmt, "string");

printf("%s\n", str); // this is a string
printf("%d\n", size); // 16

License

MIT