C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

wcout does not print wide character string in solaris.

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
iwongu
Guest





PostPosted: Thu Dec 14, 2006 10:11 am    Post subject: wcout does not print wide character string in solaris. Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.