How to output wide strings to narrow streams with standard library?

T

Timothy Madden

Hello

I noticed that
wcout << "Message text";
wcout << endl;
works just fine despite wcout being a wide stream and "Message text"
being a narrow string.

How can I get the reverse working ? I want to write wide strings to
narrow streams:
cout << L"Message text";
cout << endl;
Currently this just outputs a pointer value (The address of the first
'M' in "Message text". How can I get this expression to work ?

Thank you,
Timothy Madden
 
M

Maxim Yegorushkin

Hello

I noticed that
wcout << "Message text";
wcout << endl;
works just fine despite wcout being a wide stream and "Message text"
being a narrow string.

How can I get the reverse working ? I want to write wide strings to
narrow streams:
cout << L"Message text";
cout << endl;
Currently this just outputs a pointer value (The address of the first
'M' in "Message text". How can I get this expression to work ?

Start from
http://www.boost.org/doc/libs/1_41_0/libs/iostreams/doc/guide/code_conversion.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top