Skip to content

Commit

Permalink
Add append option to SaveAscii. Refs #9144
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Jeffery committed Jul 16, 2014
1 parent 206267d commit 585b94d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Code/Mantid/Framework/DataHandling/src/SaveAscii2.cpp
Expand Up @@ -78,6 +78,8 @@ namespace Mantid

declareProperty("ColumnHeader", true, "If true, put column headers into file. ");

declareProperty("AppendToFile", false, "If true, don't overwrite the file. Append to the end of it. ");

}

/**
Expand All @@ -98,6 +100,7 @@ namespace Mantid
int spec_min = getProperty("WorkspaceIndexMin");
int spec_max = getProperty("WorkspaceIndexMax");
bool writeHeader = getProperty("ColumnHeader");
bool appendToFile = getProperty("AppendToFile");

// Check whether we need to write the fourth column
m_writeDX = getProperty("WriteXError");
Expand Down Expand Up @@ -177,7 +180,7 @@ namespace Mantid
throw std::runtime_error("Trying to save an empty workspace");
}
std::string filename = getProperty("Filename");
std::ofstream file(filename.c_str());
std::ofstream file(filename.c_str(), (appendToFile ? std::ios::app : std::ios::out));

if (!file)
{
Expand Down

0 comments on commit 585b94d

Please sign in to comment.