I was outputing hexatdecimal values of an integer (example: 123) into a file called database.txt using the following method:
//open ofstream and all the checking
fout<<hex<<123;
and there is hexadecimal numbers appeared in the file.
But when I use istream to read it back from the file, how can I change it back to decimal again?
I used:
int number = 0;
fin>>dec>>number;
but it doesn't work. Anyone tell me a correct way to do this?
Thanx for looking.
Comments