]> git.donarmstrong.com Git - mothur.git/blobdiff - mothurout.cpp
added mothurgetpid function. fixed bug with align.seqs related to g++ 4.8 change...
[mothur.git] / mothurout.cpp
index 0f24cb2dc362c679dd16ed0eb7c50444f07e7a6e..313deef5bc913fdb2efa77e1b55d203f69e50277 100644 (file)
@@ -1364,8 +1364,8 @@ int MothurOut::appendFiles(string temp, string filename) {
                ifstream input;
        
                //open output file in append mode
-               openOutputFileAppend(filename, output);
-               int ableToOpen = openInputFile(temp, input, "no error");
+               openOutputFileBinaryAppend(filename, output);
+               int ableToOpen = openInputFileBinary(temp, input, "no error");
                //int ableToOpen = openInputFile(temp, input);
                
                int numLines = 0;
@@ -2755,6 +2755,33 @@ string MothurOut::getSimpleLabel(string label){
                exit(1);
        }
 }
+/***********************************************************************/
+string MothurOut::mothurGetpid(int threadID){
+       try {
+        
+        string pid = "";
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
+        
+               pid += toString(getpid()); if(debug) { mothurOut("[DEBUG]: " + pid + "\n"); }
+        //remove any weird chars
+        string pid1 = "";
+        for (int i = 0; i < pid.length(); i++) {
+            if(pid[i]>47 && pid[i]<58) { //is a digit
+                pid1 += pid[i];
+            }
+        }
+        pid = pid1;
+#else
+               pid += toString(threadID);
+#endif
+               return pid;
+       }
+       catch(exception& e) {
+               errorOut(e, "MothurOut", "mothurGetpid");
+               exit(1);
+       }
+}
+
 /***********************************************************************/
 
 bool MothurOut::isLabelEquivalent(string label1,  string label2){