www.digitalmars.com         C & C++   DMDScript  

c++ - wistream (Am I crazy?)

I have an wifstream object.

I am using this to read a UNICODE file into wchar_t
a character at a time. Unfortunately it seems not to be
working as I expected.

I have been trying to read the documentation for streams and
cant seem to find a definitive answer that satisfies me. The
documentation specifies that a "character" is read from the file.
I was assuming that the actual type of character depended on
the specialization (char or wchar_t).

I was expecting each get() to read one 16 bit (wchar_t) value
at a time. But what seems to be happening is that it reads
1 8 bit (char) value at a time and places it into a wchar_t.

Is this the correct behavior. If so how do you go about specializing
a stream so that it reads 16 bit values?
Jan 15 2002