mirror of
https://github.com/troydhanson/tpl.git
synced 2024-12-28 00:21:03 +08:00
28 lines
444 B
C
28 lines
444 B
C
|
#include "tpl.h"
|
||
|
#include <stdio.h>
|
||
|
|
||
|
const char *filename = "/tmp/test100.tpl";
|
||
|
int main() {
|
||
|
tpl_node *tn;
|
||
|
struct {
|
||
|
int i;
|
||
|
char c;
|
||
|
} s;
|
||
|
int p;
|
||
|
char *fmt;
|
||
|
|
||
|
tn = tpl_map("S(ic)", &s);
|
||
|
s.i = 1; s.c = '^';
|
||
|
tpl_pack(tn, 0);
|
||
|
tpl_dump(tn, TPL_FILE, filename);
|
||
|
tpl_free(tn);
|
||
|
|
||
|
fmt = tpl_peek(TPL_FILE|TPL_DATAPEEK, filename, "i", &p);
|
||
|
if (fmt) {
|
||
|
printf("fmt: %s\n", fmt);
|
||
|
printf("p: %d\n", p);
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|