I've been messing around with writing into a Unicode (UTF-8) txt file. So far, I've been manually inputting all of the hexadecimals because I'm only using two characters (the full block █, which is 0x88 0x25, and a regular space which is 0x20 0x00).
However, I'm at the end of a line and want to continue on the next, so I input 0x0D, 0x00, 0x0A and 0x00 into the file. But whenever I do that and look at the file in a hex editor, i see
0D 00 0D 0A 00
. I believe this is the compiler's fault because it's trying to write both 0D and 0A in one shot because it thinks I'm trying to insert a new line (like \n) in ANSI format.
Here's the problematic part:
1 2 3 4
|
txt.put (0x0D);
txt.put (0x00);
txt.put (0x0A);
txt.put (0x00);
|
I've also tried using
txt.write
, and
txt<<(char)0x0A;
but neither work.
I was poking around and thought maybe if I wrote
1 2 3
|
txt.put (0x0D);
txt.put (0x0A);
txt.put (0x00);
|
and then went back and replaced the second 0D (which is automatically placed there) with 00 it would work, but I haven't found a way to do that yet.
So if someone would like to help, I want to know either how to directly get 0A into the file without the extra 0D being tacked on
OR
How to go back and change the 0D to an 00 and then move on to input more stuff.
Thanks!