]> git.donarmstrong.com Git - mothur.git/blobdiff - mothur.h
paralellized screen.seqs and added mpi code to it. fixed bug with all mpi commands...
[mothur.git] / mothur.h
index 062c4814dfa4addeeb923f586c601717daca7c66..7f3608e73ee8770d8d777bde1be399c61027b515 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -865,14 +865,16 @@ inline void appendFiles(string temp, string filename) {
        
                //open output file in append mode
                openOutputFileAppend(filename, output);
-               openInputFile(temp, input);
+               int ableToOpen = openInputFile(temp, input, "no error");
                
-               while(char c = input.get()){
-                       if(input.eof())         {       break;                  }
-                       else                            {       output << c;    }
+               if (ableToOpen == 0) { //you opened it
+                       while(char c = input.get()){
+                               if(input.eof())         {       break;                  }
+                               else                            {       output << c;    }
+                       }
+                       input.close();
                }
                
-               input.close();
                output.close();
        }
        catch(exception& e) {
@@ -964,7 +966,7 @@ inline vector<long> setFilePosFasta(string filename, int& num) {
                
                        num = positions.size();
                
-                       FILE * pFile;
+                       /*FILE * pFile;
                        long size;
                
                        //get num bytes in file
@@ -974,7 +976,19 @@ inline vector<long> setFilePosFasta(string filename, int& num) {
                                fseek (pFile, 0, SEEK_END);
                                size=ftell (pFile);
                                fclose (pFile);
+                       }*/
+                       
+                       long size = positions[(positions.size()-1)];
+                       ifstream in;
+                       openInputFile(filename, in);
+                       
+                       in.seekg(size);
+               
+                       while(char c = in.get()){
+                               if(in.eof())            {       break;  }
+                               else                            {       size++; }
                        }
+                       in.close();
                
                        positions.push_back(size);