Hey thanks! That Hex Editor helped a lot. I think I got the graph I wanted, luckily the data was stored as I imagined, an array of numbers (turns out to be floats).
I'll just post what I found in case anyone else gets the same problem in the future.
Started from the 0x560 offset and read in a byte at a time till it wasn't NULL. Went back one byte, and tested each type of number. When testing for floats it gave values 0-100 which makes sense because the Y-Axis is %transmittance, as well as being fairly close to what the graph actually is. I couldn't tell for certain as it was a bit difficult to tell what the X-Axis Values were.
They said in text that the X-Axis values were 3999.6401 - 400.1568 c^-1 with resolution 2, which should come out to about 1800 numbers. But the graph had about 3700 floats. My guess would be it actually was resolution 1 as there are 3600 units, and the extra 100 numbers are nonsense.
Thanks again for your help
Here is the code:
Code:
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
char* addr(void *p)
{
return reinterpret_cast<char*>(p);
}
int main ()
{
const int SIZE = 3700; //can go till 3800 I think, but all near 0 due to Methylene Chloride.
char buffer[100];
short shortInt[SIZE];
int integer[SIZE];
long longint[SIZE];
float floatPoint[SIZE];
double doublefloat[SIZE];
for(int a = 0; a<SIZE; a++)
{
shortInt[a] = 0;
integer[a] = 0;
longint[a] = 0;
floatPoint[a] = 0;
doublefloat[a] = 0;
}
ifstream ifs ("jon_spec.SPA", ios::in|ios::binary);
if (ifs.is_open())
{
ifs.seekg (0x560, ios::beg);
for(int a = 0; a<10; a++)
{
ifs.read(buffer,1);
if(buffer[0] != 0)
{
//cout << "Loaction of non-NULL char: " << a << endl;
break;
}
}
ifs.seekg(-1L, ios::cur);
ifs.read(addr(floatPoint), sizeof(floatPoint));
ifs.close();
ofstream ofs("Graph.txt", ios::out);
// for(int a = 0; a<SIZE; a++)
// cout << floatPoint[a] << endl;
for(int a = 0; a<SIZE; a++)
ofs << floatPoint[a] << endl;
ofs.close();
}
else cout << "Unable to open ifs";
return 0;
}
EDIT: Changed line 61 to:
Code:
ofs << 4000-a << " " << floatPoint[a] << endl;
in order to show the values I were guessing at 1 resolution.
The results are very promising however there is an offset of -84 cm^-1.
I.E. The Aliphatic C-H peak is actually at 2971.55. However in the file I outputted it is 2887.
The Carbonyl peak is actually at 1741.71 but in the file I outputted it is 1658.
It is good that the shifts are consistent which means it is indeed 1 unit of resolution. The only reason I can think of that there is this shift is that they started collecting results before 4000cm^-1 even though in their text they stated that they have not.
I'll contact manufacturer to confirm.