Fixed error with push/pop position, works fine now

This commit is contained in:
Shane Grant
2013-06-14 13:32:54 -07:00
parent e9d277025f
commit 9225d1c741
2 changed files with 10 additions and 3 deletions

View File

@@ -28,7 +28,8 @@ namespace cereal
void pushPosition( size_t size )
{
itsPositionStack.push( itsStream.tellp() );
itsStream.write( 0, size );
for(size_t i = 0; i < size; ++i)
itsStream.rdbuf()->sputc('\0'); // char doesn't matter, but null-term is zero
}
//! Pops the most recently pushed position onto the archive, going to the end

View File

@@ -205,9 +205,15 @@ int main()
std::cout << std::endl;
}
std::ostringstream os;
std::ofstream os("test.txt");
cereal::BinaryOutputArchive archive(os);
std::cout << "Testing:" << std::endl;
//os.write(, 5);
archive & uint8_t();
archive & uint16_t(3);
//os.write("\0", 1);
return 0;
}