H
heyyouguys
Hi everyone, I've recently run into an issue while doing some wchar_t
stream I/O (specifically wcout), and although I've "fixed" the
problem, I'd like to get some clarification.
In the following example:
wstring somestring(L"Pretend there's other stuff in here like a (TM)
symbol and other unicode chars.");
wcout << somestring;
Is it possible for there to be characters in there that change the
state of wcout? I ask because I was walking the filesystem, hit a
certain file, and then no matter what I put into wcout from that point
forward, nothing was printed. I "fixed" it with the following:
locale::global(locale(""));
wcin.imbue(locale());
wcout.imbue(locale());
wcerr.imbue(locale());
The reason for the scare quotes, and the problem is, I have /no/ idea
why that fixed it. Do I have to escape the strings I send to cout/
wcout? I've never heard any mention of this, so if so I'm not even
sure where to start to look for the rules. Any pointers would be very
much appreciated. I imagine the environment would be important, so
here it is:
Visual C++, Microsoft Visual Studio 2005
Windows XP Pro
cmd.exe console window
Thanks!
stream I/O (specifically wcout), and although I've "fixed" the
problem, I'd like to get some clarification.
In the following example:
wstring somestring(L"Pretend there's other stuff in here like a (TM)
symbol and other unicode chars.");
wcout << somestring;
Is it possible for there to be characters in there that change the
state of wcout? I ask because I was walking the filesystem, hit a
certain file, and then no matter what I put into wcout from that point
forward, nothing was printed. I "fixed" it with the following:
locale::global(locale(""));
wcin.imbue(locale());
wcout.imbue(locale());
wcerr.imbue(locale());
The reason for the scare quotes, and the problem is, I have /no/ idea
why that fixed it. Do I have to escape the strings I send to cout/
wcout? I've never heard any mention of this, so if so I'm not even
sure where to start to look for the rules. Any pointers would be very
much appreciated. I imagine the environment would be important, so
here it is:
Visual C++, Microsoft Visual Studio 2005
Windows XP Pro
cmd.exe console window
Thanks!