1
0
mirror of https://github.com/fumiama/simple-protobuf.git synced 2026-06-08 18:10:28 +08:00

优化错误处理

This commit is contained in:
源文雨
2023-07-08 19:54:56 +08:00
parent e23ac9b6c0
commit 0bcef2d3c0
3 changed files with 117 additions and 63 deletions

4
test.c
View File

@@ -31,10 +31,10 @@ int main() {
fp = NULL;
fp = fopen("test.sp", "rb");
if(fp) {
SIMPLE_PB* spb = get_pb(fp);
simple_pb_t* spb = get_pb(fp);
memcpy(&t, spb->target, sizeof(struct TEST));
printf("a:%u\nb:%u\nc:%u\nd:%llu\ne:%s\n", t.a, t.b, t.c, t.d, t.e);
printf("Struct size: %u, read: %u\n", spb->struct_len, spb->real_len);
} else perror("[SPB]");
} else perror("[SPB]");
}
}