1 #include "tpl.h"
2 #include <stdio.h>
3
4 const char *filename="/tmp/test96.tpl";
main()5 int main() {
6 tpl_node *tn;
7 int i;
8 char *s1 = NULL, *s2 = "", *s3 = "hello";
9 tn = tpl_map("A(sss)", &s1, &s2, &s3);
10 for(i=0;i<5;i++) {
11 tpl_pack(tn,1);
12 }
13 tpl_dump(tn,TPL_FILE,filename);
14 tpl_free(tn);
15
16 s1 = s2 = s3 = (char*)0x1; /* overwritten below */
17 tn = tpl_map("A(sss)", &s1, &s2, &s3);
18 tpl_load(tn,TPL_FILE,filename);
19 while( tpl_unpack(tn,1) > 0) {
20 printf("s1 %s\n", s1?s1:"NULL");
21 printf("s2 %s\n", s2?s2:"NULL");
22 printf("s3 %s\n", s3?s3:"NULL");
23 }
24 tpl_free(tn);
25 return(0);
26 }
27
28