For some reason this sort code is not working as I would expect:
std::fstream theFile; theFile.open(, std::ios::beg |std::ios::out|std::i
You need to typecast the values first as a char, otherwise the iostream library sees the values as int and formats them as a readable string.
char
int
theFile << (char)1 << (char)25;