ref: 5a0e28438fe4c0f8cc55430c388c2016cc185cbf
dir: /snprintandf.c/
#include <u.h> #include <libc.h> #include <stdio.h> void main() { char *s; int l; s = malloc(128); l = snprint(s, 128, "%s%s", "hi", "there"); print("%s(%d)\n", s, l); l = snprintf(s, 128, "%s%s", "hi", "there"); print("%s(%d)\n", s, l); free(s); exits(0); }