1
0
mirror of https://github.com/fumiama/simple-protobuf.git synced 2026-06-22 19:40:38 +08:00

修正include

This commit is contained in:
fumiama
2021-05-19 13:14:06 +08:00
parent a8d503137e
commit 3263a960c2
3 changed files with 5 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "simple_protobuf.h" #include "simple_protobuf.h"
static uint32_t read_num(FILE* fp) { static uint32_t read_num(FILE* fp) {

View File

@@ -1,6 +1,7 @@
#ifndef _SIMPLE_PROTOBUF_H_ #ifndef _SIMPLE_PROTOBUF_H_
#define _SIMPLE_PROTOBUF_H_ #define _SIMPLE_PROTOBUF_H_
#include <stdio.h>
#include <stdint.h> #include <stdint.h>
struct SIMPLE_PB { struct SIMPLE_PB {

2
test.c
View File

@@ -33,7 +33,7 @@ int main() {
if(fp) { if(fp) {
SIMPLE_PB* spb = get_pb(fp); SIMPLE_PB* spb = get_pb(fp);
memcpy(&t, spb->target, sizeof(struct TEST)); 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("a:%u\nb:%u\nc:%u\nd:%lu\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); printf("Struct size: %u, read: %u\n", spb->struct_len, spb->real_len);
} else perror("[SPB]"); } else perror("[SPB]");
} else perror("[SPB]"); } else perror("[SPB]");