I'm writing an unsigned char with a value of three to a file and when I read it it's returned as 255.
Can anyone please tell me what I've done wrong? Thank you for your time.Code:
fout.open("cdb.dat", ios::out | ios::binary);
unsigned char c = 3;
fout << c;
fin.open("cdb.dat", ios::in | ios::binary);
c = fin.get(),
cout << static_cast<int>(c) << endl;