I have a large file thats about 400k that I need to read text data from. The problem I'm having is that the format is a bit weird to me. It seems to have 2 bytes used for one character (some kind of unicode text??). The second byte of the character is always zero but the first byte is ASCII. What I want to do is read the whole file into a string but the reading always stops after reading a byte that contains zero (0x00).
The way I have coded this is like:
contents << file.rdbuf ();
std::string cont = contents.str ();
Inside the example.txt file would be the text (for example):
But the data inside actually looks like (through a hex editor):
48 00 65 00 6C 00 6C 00 6F 00
So when the text is read it will stop at the h. Is there a way to read the whole file in and not stop at the 'zero value' bytes?