X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=fileoutput.cpp;h=117f8ab1c3a9a93c5f80f38613c4aefa1c898e32;hb=2df35fdeea85f574630d75b11fb5b08c39aec31a;hp=cd3a1c74084de46dd7f5c7805d3425f0d0dd3ecb;hpb=5b9b3e01150055e3b4bb1a911ea4c61d0b755e89;p=mothur.git diff --git a/fileoutput.cpp b/fileoutput.cpp index cd3a1c7..117f8ab 100644 --- a/fileoutput.cpp +++ b/fileoutput.cpp @@ -40,7 +40,7 @@ void ThreeColumnFile::initFile(string label){ outFile.setf(ios::showpoint); } catch(exception& e) { - errorOut(e, "ThreeColumnFile", "initFile"); + m->errorOut(e, "ThreeColumnFile", "initFile"); exit(1); } } @@ -60,7 +60,7 @@ void ThreeColumnFile::output(int nSeqs, vector data){ } } catch(exception& e) { - errorOut(e, "ThreeColumnFile", "output"); + m->errorOut(e, "ThreeColumnFile", "output"); exit(1); } } @@ -81,14 +81,16 @@ void ThreeColumnFile::resetFile(){ remove(inName.c_str()); renameOk = rename(outName.c_str(), inName.c_str()); + //renameFile(outName, inName); + //checks to make sure user was able to rename and remove successfully if ((renameOk != 0)) { - mothurOut("Unable to rename " + outName); mothurOutEndLine(); + m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine(); perror(" : "); } } catch(exception& e) { - errorOut(e, "ThreeColumnFile", "resetFile"); + m->errorOut(e, "ThreeColumnFile", "resetFile"); exit(1); } } @@ -132,7 +134,7 @@ void ColumnFile::initFile(string label, vector tags){ outFile.setf(ios::showpoint); } catch(exception& e) { - errorOut(e, "ColumnFile", "initFile"); + m->errorOut(e, "ColumnFile", "initFile"); exit(1); } } @@ -162,7 +164,7 @@ void ColumnFile::output(vector data){ } catch(exception& e) { - errorOut(e, "ColumnFile", "output"); + m->errorOut(e, "ColumnFile", "output"); exit(1); } } @@ -183,14 +185,16 @@ void ColumnFile::resetFile(){ remove(inName.c_str()); renameOk = rename(outName.c_str(), inName.c_str()); + //renameFile(outName, inName); + //checks to make sure user was able to rename and remove successfully if ((renameOk != 0)) { - mothurOut("Unable to rename " + outName); mothurOutEndLine(); + m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine(); perror(" : "); } } catch(exception& e) { - errorOut(e, "ColumnFile", "resetFile"); + m->errorOut(e, "ColumnFile", "resetFile"); exit(1); } } @@ -227,7 +231,7 @@ void SharedThreeColumnFile::initFile(string label){ outFile.setf(ios::showpoint); } catch(exception& e) { - errorOut(e, "SharedThreeColumnFile", "initFile"); + m->errorOut(e, "SharedThreeColumnFile", "initFile"); exit(1); } } @@ -248,7 +252,7 @@ void SharedThreeColumnFile::output(int nSeqs, vector data){ } } catch(exception& e) { - errorOut(e, "SharedThreeColumnFile", "output"); + m->errorOut(e, "SharedThreeColumnFile", "output"); exit(1); } } @@ -265,17 +269,20 @@ void SharedThreeColumnFile::resetFile(){ outFile.close(); } counter = 1; + remove(inName.c_str()); renameOk = rename(outName.c_str(), inName.c_str()); + //renameFile(outName, inName); + //checks to make sure user was able to rename and remove successfully if ((renameOk != 0)) { - mothurOut("Unable to rename " + outName); mothurOutEndLine(); + m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine(); perror(" : "); } } catch(exception& e) { - errorOut(e, "SharedThreeColumnFile", "resetFile"); + m->errorOut(e, "SharedThreeColumnFile", "resetFile"); exit(1); } } @@ -313,7 +320,7 @@ void OneColumnFile::initFile(string label){ outFile.setf(ios::showpoint); } catch(exception& e) { - errorOut(e, "OneColumnFile", "initFile"); + m->errorOut(e, "OneColumnFile", "initFile"); exit(1); } } @@ -333,7 +340,7 @@ void OneColumnFile::output(int nSeqs, vector data){ } } catch(exception& e) { - errorOut(e, "OneColumnFile", "output"); + m->errorOut(e, "OneColumnFile", "output"); exit(1); } } @@ -345,22 +352,25 @@ void OneColumnFile::resetFile(){ if(counter != 0){ outFile.close(); inFile.close(); - } - else{ + }else{ outFile.close(); } counter = 1; + remove(inName.c_str()); renameOk = rename(outName.c_str(), inName.c_str()); + //renameFile(outName, inName); + //checks to make sure user was able to rename and remove successfully if ((renameOk != 0)) { - mothurOut("Unable to rename " + outName); mothurOutEndLine(); + m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine(); perror(" : "); } + } catch(exception& e) { - errorOut(e, "OneColumnFile", "resetFile"); + m->errorOut(e, "OneColumnFile", "resetFile"); exit(1); } } @@ -399,7 +409,7 @@ void SharedOneColumnFile::initFile(string label){ outFile.setf(ios::showpoint); } catch(exception& e) { - errorOut(e, "SharedOneColumnFile", "initFile"); + m->errorOut(e, "SharedOneColumnFile", "initFile"); exit(1); } } @@ -426,7 +436,7 @@ void SharedOneColumnFile::output(int nSeqs, vector data){ } } catch(exception& e) { - errorOut(e, "SharedOneColumnFile", "output"); + m->errorOut(e, "SharedOneColumnFile", "output"); exit(1); } } @@ -445,17 +455,18 @@ void SharedOneColumnFile::resetFile(){ counter = 1; remove(inName.c_str()); - renameOk = rename(outName.c_str(), inName.c_str()); + //renameFile(outName, inName); + //checks to make sure user was able to rename and remove successfully if ((renameOk != 0)) { - mothurOut("Unable to rename " + outName); mothurOutEndLine(); + m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine(); perror(" : "); } } catch(exception& e) { - errorOut(e, "SharedOneColumnFile", "resetFile"); + m->errorOut(e, "SharedOneColumnFile", "resetFile"); exit(1); } }