- #1
Leannie
- 7
- 0
Hi! I don't know if I am even wording this right but here goes. I have to write a programme to read two data files into C++, then ouput as one file in the same format.
The two files are files of 10 bit data. Each 10-bit recorded value is represented by a 16 bit word, of which the top 6 bits are not in use.
I have managed to read in the files using "ifstream inFile(. . . . .)"
I want to ouput the result as ((data1-data2)/(data1+data2))*1000.
I have tried using "inFile.get()" but that only takes 1 byte from the file and puts it into my result variable. Hence I end up with every value as 00. I want to take the first byte and times by 256 (100 in hexidecimal) and add the 2nd byte on.
My problem is how do I copy 2 bytes of data?
I know it is something to do with byte swapping, lobyte and high byte and I want C=A*256+B where every A is 00. But I have no idea how to do this?
Any help would be great,
thanks in advance :)
The two files are files of 10 bit data. Each 10-bit recorded value is represented by a 16 bit word, of which the top 6 bits are not in use.
I have managed to read in the files using "ifstream inFile(. . . . .)"
I want to ouput the result as ((data1-data2)/(data1+data2))*1000.
I have tried using "inFile.get()" but that only takes 1 byte from the file and puts it into my result variable. Hence I end up with every value as 00. I want to take the first byte and times by 256 (100 in hexidecimal) and add the 2nd byte on.
My problem is how do I copy 2 bytes of data?
I know it is something to do with byte swapping, lobyte and high byte and I want C=A*256+B where every A is 00. But I have no idea how to do this?
Any help would be great,
thanks in advance :)