]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libstdio/snprintf.c
pc: add vmx device
[plan9front.git] / sys / src / libstdio / snprintf.c
1 /*
2  * pANS stdio -- sprintf
3  */
4 #include "iolib.h"
5 int snprintf(char *buf, int nbuf, const char *fmt, ...){
6         int n;
7         va_list args;
8         FILE *f=sopenw();
9         if(f==NULL)
10                 return 0;
11         setvbuf(f, buf, _IOFBF, nbuf);
12         va_start(args, fmt);
13         n=vfprintf(f, fmt, args);
14         va_end(args);
15         sclose(f);
16         return n;
17 }