Commit 16885b3e authored by Purves, Murray's avatar Purves, Murray
Browse files

Fixing byte skip in PCF header read

parent caebf42a
......@@ -179,6 +179,9 @@ bool SpectrumPCFStream<data_type>::read_from(const std::string &file)
radix_line(" No deviation pairs present");
// Set SRSI to correct value
mData->setSrsi(2);
// Need to rewind to 256 bytes (start of spectrum header data)
stream.skipBytes(-30);
}
// Set deviation pairs
mData->setDeviationPairEnergies(deviationPairEnergies);
......@@ -204,7 +207,7 @@ bool SpectrumPCFStream<data_type>::read_from(const std::string &file)
// Using a delimiter character
radix_line(" Splitting using delimiter (" << delim << ")...");
std::vector<std::string> bufferItems =
split_string(std::string(1, delim), trim_string(buffer));
split_string(std::string(1, delim), trim_string(buffer), true);
if (bufferItems.size() > 0)
{
title = trim_string(bufferItems[0]);
......@@ -475,11 +478,7 @@ bool SpectrumPCFStream<data_type>::write_to(const std::string &file) const
{
// Don't write deviation pairs
radix_line(" No deviation pairs found:");
// Skip to 512 bytes (start of spectral data)
stream.write(make_length(" ", 512 - stream.bytesWritten()).c_str(),
512 - stream.bytesWritten());
// Add bytes written directly to eafstream count
stream.setBytesWritten(512);
// Don't need to skip anything - spectrum header data starts at 256 bytes
}
// Write spectrum data
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment