Dear all,
I think it is simple program. But I really face problem and tired out of finding solution. So, I really need your help.
Here is the problem.
I saved 7E FF FF FF FF FF FF 7E (8 bytes) data in binary file.
I would like to retrieve it as reverse order with binary file.
The following is output function.
void outputint64(int i) {
__int64 app1 = (__int64)mem[i+3] << 48; __int64 app2 = (__int64)mem[i+2] << 32;
__int64 app3 = (__int64)mem[i+1] << 16;
__int64 app4 = (__int64)mem[i];
__int64 app = (__int64)app1 | (__int64)app2 | (__int64)app3 | (__int64)app4;
printf("int64 value is : %I64x", app);
}
app1 output is 0x 7E FF 00 00 00 00 00 00 //the output is as I expect
app2 output is 0x FF FF FF FF 00 00 00 00 //actually I only expect 0x 00 00 FF FF 00 00 00 00
app3 output is 0x FF FF FF FF FF FF 00 00 //actually I only expect 0x 00 00 00 00 FF FF 00 00
app4 output is 0x FF FF FF FF FF FF FF 7E //actually I only expect 0x 00 00 00 00 00 00 FF 7E
So, app output becomes 0x FF FF FF FF FF FF FF 7E, even though I expect as 0x 7E FF FF FF FF FF FF 7E.
How should I modify to get the expected result?
If you have any idea, please help me.
Thanks in advance.