blob: 875915c46b1a667be68b61a9ef771fb984b9ae7d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <c/stp/stpe/stpecpy.h>
#include <stddef.h>
#include <stdio.h>
int
main(void)
{
char buf[11];
char *p, *end;
size_t len;
end = buf + sizeof(buf);
p = buf;
p = c_stpecpy(p, end, "Hello ");
p = c_stpecpy(p, end, "world");
p = c_stpecpy(p, end, "!");
p = c_stpecpy(p, end, "");
if (p == end) {
p--;
puts("Truncated:");
}
len = p - buf;
printf("%zu: ", len);
puts(buf);
}
|