sorry for another question about this, but this one is different.
i wrote a script earlier to read and write 4 byte integers to files, now i'm working on one to read and write 2 byte intgers. can anyone tell me what i did wrong with this script?
i know the script is way off because i tried saving 61921 and it read back 223. thank you for your time.
void bin_write_2bytes(ofstream *file, unsigned int value)
unsigned char byteA = (value/253) + 1;
unsigned char byteB = (value%253) + 1;
*file << byteA;
*file << byteB;
unsigned int bin_read_2bytes(ifstream *file)
unsigned char byteA = file->get()*253;
unsigned char byteB = file->get();
unsigned int value = byteA + byteB;