X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothurout.cpp;fp=mothurout.cpp;h=3e4db45bcc43990a18f7d8e51493388d28a6d850;hb=859e3a473a3e63e0060c49be70b80f9289253da2;hp=f7b0d86bf93ff1c3f1ff6ec4ad62d21d66fc382b;hpb=0a9b5ee954b60abbd24c797cece23fb4a487cc8a;p=mothur.git diff --git a/mothurout.cpp b/mothurout.cpp index f7b0d86..3e4db45 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -1170,7 +1170,42 @@ int MothurOut::appendFiles(string temp, string filename) { exit(1); } } - +/**************************************************************************************************/ +int MothurOut::appendFilesWithoutHeaders(string temp, string filename) { + try{ + ofstream output; + ifstream input; + + //open output file in append mode + openOutputFileAppend(filename, output); + int ableToOpen = openInputFile(temp, input, "no error"); + //int ableToOpen = openInputFile(temp, input); + + int numLines = 0; + if (ableToOpen == 0) { //you opened it + + string headers = getline(input); gobble(input); + if (debug) { mothurOut("[DEBUG]: skipping headers " + headers +'\n'); } + + char buffer[4096]; + while (!input.eof()) { + input.read(buffer, 4096); + output.write(buffer, input.gcount()); + //count number of lines + for (int i = 0; i < input.gcount(); i++) { if (buffer[i] == '\n') {numLines++;} } + } + input.close(); + } + + output.close(); + + return numLines; + } + catch(exception& e) { + errorOut(e, "MothurOut", "appendFiles"); + exit(1); + } +} /**************************************************************************************************/ string MothurOut::sortFile(string distFile, string outputDir){ try {