 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
iwongu Guest
|
Posted: Thu Dec 14, 2006 10:11 am Post subject: wcout does not print wide character string in solaris. |
|
|
Hi,
I have a question about std::wcout and its underlying C functions.
According to C99, a stream have an orientation type that is one of
byte-oriented or wide-one, and it is determined by the first using C
function on that stream. And the specific orientation functions should
not be applied to the stream that have other orientation.
And, the follwing code is working; (gcc 3.4.3 in solaris 10 x86)
wcout << "abcd" << endl;
wcout << "한글efgh" << endl; // the first four bytes are Korean
// characters.
wcout << "ijkl" << endl;
The result is;
abcd
한글efgh
ijkl
But the following is not.
wcout << L"abcd" << endl;
wcout << L"한글efgh" << endl;
wcout << L"ijkl" << endl;
The result is;
abcd
All characters are not printed after I try to print Korean.
I assumed that wcout might use byte-function (not wide-) to print
narrow characters even though it is wide character string literal. So
the stdout had byte-orientation and the rest are not printed because
they are wide-oriented function. But this assumption can not explain
the
last line; L"ijkl".
I tried more code.
wcout << "abcd" << endl;
wcout << L"한글efgh" << endl;
wcout << "ijkl" << endl;
The result is;
abcd
:-|
wcout << "abcd" << endl;
wcout << L"한글efgh" << endl;
cout << "ijkl" << endl; // <-- changed to cout
The result is;
abcd
ijkl
Is this a bug in compiler? What's the standard-correct output for this?
Thanks in advance.
iwongu. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|