Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions scopeprotocols/CSVExportFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,24 @@ void CSVExportFilter::Export()
{
auto mode = static_cast<ExportMode_t>(m_parameters[m_mode].GetIntVal());

string filename = m_parameters[m_fname].GetFileName();
if(filename.empty()){
AddErrorMessage("Output file","CSV Output filename is blank");
return;
}


bool append = (mode == MODE_CONTINUOUS_APPEND) || (mode == MODE_MANUAL_APPEND);
if(append)
m_fp = fopen(m_parameters[m_fname].GetFileName().c_str(), "ab");
m_fp = fopen(filename.c_str(), "ab");
else
m_fp = fopen(m_parameters[m_fname].GetFileName().c_str(), "wb");
m_fp = fopen(filename.c_str(), "wb");

if(!m_fp){
AddErrorMessage("I/O error","Error opening file: "+filename);
LogError("CSVExportFilter: fopen() returned null trying to open file %s\n",filename.c_str());
return;
}

//See if file is empty. If so, write header
fseek(m_fp, 0, SEEK_END);
Expand Down