lundi 21 mai 2018

C++ Wstream: bypass BOM bytes

I have the following statement:

std::wfilebuf fb("myfile",std::ios::in);
std::wistream is(&fb);

is.read(content[0],length);

And my stream gets its error byte set when it consumes a BOM byte mid-file.

I have tried workarounds where I do a while loop and increment the stream position while these bytes are present, but this did not work. I have tried reading using a for loop and absolute seeks, however this was very slow.

There must be a way to ignore the BOM during the wstream?

Aucun commentaire:

Enregistrer un commentaire