Remove also 'white lines' at the end of the output file when using the automatic header inclusion in msr2data
This commit is contained in:
parent
0a422229b1
commit
bd9c562eb9
@ -51,6 +51,13 @@ using namespace boost::algorithm;
|
||||
|
||||
#include "PMsr2Data.h"
|
||||
|
||||
// determine the length of the linebreak string for different systems ('\r' (old) Macintosh, '\n' Unix, "\r\n" DOS)
|
||||
#if defined(__MSDOS__) || defined(_MSC_VER)
|
||||
#define INCR 2
|
||||
#else
|
||||
#define INCR 1
|
||||
#endif /* __MSDOS__ || _MSC_VER */
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p> Write formatted output to column-formatted ASCII output file
|
||||
@ -1954,9 +1961,10 @@ int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHead
|
||||
int size(outFile.tellg());
|
||||
string s;
|
||||
|
||||
for (int i(1); i<=size; ++i) { // find the last non-empty line -- this procedure at the moment probably breaks native Windows support
|
||||
for (int i(INCR); i<=size; i+=INCR) { // find the last non-empty line
|
||||
outFile.seekg(-i, ios::end);
|
||||
getline(outFile, s);
|
||||
trim(s); // remove whitespace
|
||||
if (s.empty()) {
|
||||
if (i == size) {
|
||||
outFile.seekp(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user