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:ofstream fout;
fout.open("cdb.dat", ios::out | ios::binary);
unsigned char c = 3;
fout << c;
fout.close();
fin.open("cdb.dat", ios::in | ios::binary);
unsigned char
c = fin.get(),
cout << static_cast<int>(c) << endl;
fin.close();