From 054cb90c25417ba44eb528cb174f3571674ee430 Mon Sep 17 00:00:00 2001 From: Ralf Hartmann Date: Thu, 12 Oct 2000 11:50:27 +0000 Subject: [PATCH] reconstruct old block_write/read format (MT save). git-svn-id: https://svn.dealii.org/trunk@3427 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/vector.templates.h | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/deal.II/lac/include/lac/vector.templates.h b/deal.II/lac/include/lac/vector.templates.h index 9c7d890173..e979d8b31a 100644 --- a/deal.II/lac/include/lac/vector.templates.h +++ b/deal.II/lac/include/lac/vector.templates.h @@ -616,11 +616,12 @@ void Vector::block_write (ostream &out) const // problems in a multithreaded // environment const unsigned int sz = size(); - out.write (reinterpret_cast(&sz), - reinterpret_cast(&sz+1) - - reinterpret_cast(&sz)); - const char intro = '['; - out.write (&intro, 1); + char buf[16]; + + sprintf(buf, "%d", sz); + strcat(buf, "\n["); + + out.write(buf, strlen(buf)); out.write (reinterpret_cast(begin()), reinterpret_cast(end()) - reinterpret_cast(begin())); @@ -640,12 +641,12 @@ void Vector::block_read (istream &in) AssertThrow (in, ExcIO()); unsigned int sz; - // other version of - // in >> sz; - // reason as above - in.read (reinterpret_cast(&sz), - reinterpret_cast(&sz+1) - - reinterpret_cast(&sz)); + + char buf[16]; + + + in.getline(buf,16,'\n'); + sz=atoi(buf); // fast initialization, since the // data elements are overwritten anyway -- 2.39.5