this code does not work. It only copy the exact text from character.txt to bcharacter.txt without converting it to binary eventhough i added this code -- infile.open ("character.txt", ios::out | ios::app | ios::binary);
So, how can i change my codes in order for it to convert text to binary before printing it to a new text file? I'm not sure if my codes are correct..
Now, by binary, do you mean ones and zeroes? despite the name, the ios::binary flag does not actually convert it into binary numbers.
I guess you could read the file into a string, and loop through every character, replacing it with its binary value counterpart... As far as I know, there's no existing function that does such a thing, but it should be quite feasible to write one yourself.