Commit | Line | Data |
---|---|---|
1 | #include <stdio.h> | |
2 | #include <string.h> | |
3 | ||
4 | int main() | |
5 | { | |
6 | char buf[100]; | |
7 | ||
8 | char *expected; | |
9 | ||
10 | expected = "header 9999, hello, 005, ' 9'"; | |
11 | ust_safe_snprintf(buf, 99, "header %d, %s, %03d, '%3$*d'", 9999, "hello", 5, 9); | |
12 | if(strcmp(buf, expected) != 0) { | |
13 | printf("Error: expected \"%s\" and got \"%s\"\n", expected, buf); | |
14 | return 1; | |
15 | } | |
16 | ||
17 | return 0; | |
18 | } |