diff --git a/binary_archive/binary_archive.hpp b/binary_archive/binary_archive.hpp index d66e6383..00df3b90 100644 --- a/binary_archive/binary_archive.hpp +++ b/binary_archive/binary_archive.hpp @@ -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 diff --git a/test.cpp b/test.cpp index beadc841..79c32feb 100644 --- a/test.cpp +++ b/test.cpp @@ -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; }