I've been struggling with a Cereal serialization issue for hours.
If my struct is serialized on Windows and deserialized on Android it fails with:
cereal::Exception: Failed to read 1 bytes from input stream! Read 0" failed
if the binary file is serialized on Android and deserialized on Windows it works. And also works on Windows/Windows and Android/Android. In all cases the binary file is exactly one byte.
I have exactly the same code running on Windows and Android Linux, and just one bool inside my serialized struct. (cereal version is the same on both builds)
This is what I do to serialize:
ofstream os_out("data.bin", std::ios_base::binary | ios::binary);
{
cereal::BinaryOutputArchive archive_out(os_out);
archive_out(a);
}
os_out << std::flush;
os_out.close();
And to deserialize:
std::ifstream os_in("data.bin", std::ios_base::binary);
{
cereal::BinaryInputArchive archive_in(os_in);
archive_in(a);
}
os_in.close();
Cannot figure out what is wrong...