How to read single bytes from wifstream

I think tile says nearly all:

I want to read a single byte from a wifstream. With an ifstream I would use read(), but given that the char type for an wifstream is wchar_t (2 bytes), this is also being used by read(), so how can I read a single byte from such a stream?
If you want a single byte why are you not using ifstream?
Just discovering the world of Unicode...

Because I have to read Unicode characters from that file, but also single bytes (it starts all with the Byte Order Mark).

Either you're using wifstream, and letting C++ do the conversions, or you're using ifstream and examining/ converting the individual bytes. BOM is just another character.
If you need to examine the BOM to decide which conversion to imbue into your wifstream, open the file with an ifstream first.
Topic archived. No new replies allowed.