Changeset 12035 for trunk/FACT++
- Timestamp:
- 09/08/11 16:24:29 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Fits.cc
r11838 r12035 22 22 23 23 #include <sys/stat.h> //for file stats 24 #include <cstdio> // for file rename 24 25 25 26 using namespace std; … … 91 92 fRunNumber = runNumber; 92 93 fMess = out; 94 fFileName = fileName; 93 95 94 96 if (fFile) … … 177 179 return true; 178 180 } 179 181 void Fits::MoveFileToCorruptedFile() 182 { 183 ostringstream corruptName; 184 struct stat st; 185 int append = 0; 186 corruptName << fFileName << "corrupt" << append; 187 while (stat(corruptName.str().c_str(), &st)) 188 { 189 append++; 190 corruptName.str(""); 191 corruptName << fFileName << "corrupt" << append; 192 } 193 if (rename(fFileName.c_str(), corruptName.str().c_str()) != 0) 194 fMess->Error("Could not rename file " + fFileName); 195 else 196 fMess->Message("Renamed file " + fFileName + " to " + corruptName.str()); 197 198 } 180 199 // -------------------------------------------------------------------------- 181 200 // … … 213 232 { 214 233 Close(); 234 MoveFileToCorruptedFile(); 215 235 return false; 216 236 } -
trunk/FACT++/src/Fits.h
r11716 r12035 18 18 private: 19 19 FitsFile *fFile; 20 string fFileName; 20 21 21 22 ///Name of the "standard", i.e. data found in every fits file … … 48 49 ///Write the FITS header keys 49 50 bool WriteHeaderKeys(); 51 //if a write error occurs 52 void MoveFileToCorruptedFile(); 53 54 50 55 51 56 public:
Note:
See TracChangeset
for help on using the changeset viewer.