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