i***d 发帖数: 28 | 1 如果一个二进制文件中存有不同类型的结构体例如:
struct A{
int a;
char b;
};
struct B{
string a;
float b;
};
struct C{
vector a;
A a;
};
...
用户知道这些结构体的数目和具体实现,但不知道这些他们在二进制文件中的排列
顺序和位置。 C++ (不用Boost)有没有什么办法可以把相同结构体(比如struct A)从
二进制文件 提取出来啊? 谢谢!
| r***6 发帖数: 401 | 2 There must be some type indicator in the file to indicate the record type.
Further more, string has to be char *, and vector has to have a size. so
sizeof(B) and sizeof(C) varies. So you definitely need record separator/
indicator. |
|