]> git.treefish.org Git - phys/latlib.git/blobdiff - writeout.cpp
...
[phys/latlib.git] / writeout.cpp
index 73adfa684ddd79eda8191cc1b448c74220ccdce2..0cb486caf5ecbb5942593cc269dea78e5c3cc562 100644 (file)
@@ -26,7 +26,7 @@ writeout::writeout(const string& wdir, const string& signature,
   if(wdir != ""){
     numprocs = procs;
     sprintf(cRank, "%d", rank);
-    fulldir = wdir + "/" + tstamp(timestamp) + "_" + signature;
+    fulldir = wdir + "/" + tstamp(timestamp) + "_" + signature + ".tmp";
     mkdir( fulldir.c_str(),  0775);
 
     if(rank>0) of.open( (fulldir + "/rank" + cRank + ".tmp").c_str() );
@@ -69,6 +69,7 @@ writeout::~writeout()
            }
          of << "#end" << endl << flush;
          of.close();
+         rename( fulldir.c_str(), fulldir.substr(0, fulldir.length()-4).c_str() );
        }
       else
        {