From: hartmann Date: Thu, 12 Oct 2000 11:50:27 +0000 (+0000) Subject: reconstruct old block_write/read format (MT save). X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f87af1b2b7135d6ef71fe6287ec97e4fc37ff706;p=dealii-svn.git reconstruct old block_write/read format (MT save). git-svn-id: https://svn.dealii.org/trunk@3427 0785d39b-7218-0410-832d-ea1e28bc413d --- 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