I working on saving Data into text file and compare it with another text file. Below is the code I worked on:
ofstream outfile;
outfile.open("Data",ios::out | ios :: binary);
for(x=0; x<100; x++)
{
printf("data- %x\n", *(((int*)pImagePool)+x));
int data = *(((int*)pImagePool)+x);
//outfile<<(reinterpret_cast<int *>(data))<<endl;
outfile<<(int *)data<<endl;
}
The result from printf
is 24011800
and result read from text file is 0x24011800
Why there is 0x
appeared? Do we able to remove it?
What is the difference between reinterpret_cast<int *> & (int *)
but both giving the same result?