ref: 990ceeef3bfd9d56e2e6dd39cf5ac185b1a2de08
dir: /sys/src/libstdio/snprintf.c/
/* * pANS stdio -- sprintf */ #include "iolib.h" int snprintf(char *buf, int nbuf, const char *fmt, ...){ int n; va_list args; FILE *f=sopenw(); if(f==NULL) return 0; setvbuf(f, buf, _IOFBF, nbuf); va_start(args, fmt); n=vfprintf(f, fmt, args); va_end(args); sclose(f); return n; }