summaryrefslogtreecommitdiff
path: root/snprintandf.c
blob: 17707a25388e164455df532400c19df1f8e38ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#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);
}