blob: fb076af63b72bed7187115e415035928356abbe9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "internal.h"
// makef returns a new dynamic string object
string
string·makef(byte *fmt, ...)
{
vlong n;
string s;
va_list args;
char bytes[256];
s = string·nnmake(nil, 0, arrlen(bytes));
va_start(args, fmt);
do{
n = fmt·vnsprint(bytes, arrlen(bytes), fmt, args);
string·append(&s, bytes);
}while(n==arrlen(bytes));
va_end(args);
return s;
}
|