]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
reconstruct old block_write/read format (MT save).
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 12 Oct 2000 11:50:27 +0000 (11:50 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 12 Oct 2000 11:50:27 +0000 (11:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@3427 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/vector.templates.h

index 9c7d8901732a1f48fd4cefad6e550b1dc6f51930..e979d8b31aaad5ef6ed1f8cf25ff53a6ffa19197 100644 (file)
@@ -616,11 +616,12 @@ void Vector<Number>::block_write (ostream &out) const
                                   // problems in a multithreaded
                                   // environment
   const unsigned int sz = size();
-  out.write (reinterpret_cast<const char*>(&sz),
-            reinterpret_cast<const char*>(&sz+1)
-            - reinterpret_cast<const char*>(&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<const char*>(begin()),
             reinterpret_cast<const char*>(end())
             - reinterpret_cast<const char*>(begin()));
@@ -640,12 +641,12 @@ void Vector<Number>::block_read (istream &in)
   AssertThrow (in, ExcIO());
 
   unsigned int sz;
-                                  // other version of
-                                  //  in >> sz;
-                                  // reason as above
-  in.read (reinterpret_cast<void*>(&sz),
-          reinterpret_cast<const char*>(&sz+1)
-          - reinterpret_cast<const char*>(&sz));
+
+  char buf[16];
+  
+
+  in.getline(buf,16,'\n');
+  sz=atoi(buf);
   
                                   // fast initialization, since the
                                   // data elements are overwritten anyway

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.