]> git.donarmstrong.com Git - mothur.git/blobdiff - mothur.h
added getline function to mothur and modified places where we use getline to use...
[mothur.git] / mothur.h
index 2efdda8bda209ec303dd7e6bc1b8650b5eb65949..29124330420f1af5e8a7b5f54fb8f86689e20ee9 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -167,6 +167,30 @@ inline int openOutputFileAppend(string fileName, ofstream& fileHandle){
        }
 
 }
+/***********************************************************************/
+
+inline string getline(ifstream& fileHandle) {
+       try {
+       
+               string line = "";
+               
+               while (!fileHandle.eof())       {
+                       //get next character
+                       char c = fileHandle.get(); 
+                       
+                       //are you at the end of the line
+                       if (c == 10 || c == 13){   break;       }       
+                       else {          line += c;              }
+               }
+               
+               return line;
+               
+       }
+       catch(exception& e) {
+               cout << "Error in mothur function getline" << endl;
+               exit(1);
+       }
+}
 
 /**************************************************************************************************/