473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Is there a version of cout which can take a wstring?

Hello

I can do this:

std::wstring strHello;
std::cout << strHello.c_str() << std::endl;

But not this:

std::cout << strHello << std::endl;

if unicode is defined.

Is it possible?


Jul 21 '07 #1
1 17512
On 2007-07-21 15:57, Angus wrote:
Hello

I can do this:

std::wstring strHello;
std::cout << strHello.c_str() << std::endl;

But not this:

std::cout << strHello << std::endl;
std::wcout << strHello << std::endl;
^^^

--
Erik Wikström
Jul 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Saurabh Aggrawal | last post by:
Hi, On line nos. 24, 25, 26 24: wstring cfMethods = {{L"setLabel"},{L""}}; 25: wstring cfProperties= {{L"isVisible"},{L""}}; 26: wstring cfEvents =...
6
by: gerg | last post by:
How would one convert a wstring to a string? This is what I have so far: bool copyto(std::string& l,std::wstring& r) { bool ret = false; size_t i = 0; const size_t n = r.length()+1;
8
by: Divick | last post by:
Hi all, can somebody tell how much std::wstring is supported across different compilers on different platforms? AFAIK std::string is supported by almost all C++ compilers and almost all platforms,...
9
by: Mwob | last post by:
Hi, I have a very simple function, declared like this: wstring CMyClass::GetDate() { .... wcsftime (sDateString,255,L"%d-%b-%Y",&dTmpDate); wstring sText(sDateString); return sText;
2
by: wolverine | last post by:
Hi Could any one tell me how to compile the code using wstring with g++ or gcc. I am using gcc version 3.4.2 #include<iostream> #include<string> using namespace std; int main() {
10
by: v4vijayakumar | last post by:
1. why the following program is not working as expected? #include <iostream> using namespace std; int main() { string t("test"); wcout << (wchar_t *) t.c_str() << endl; wcout << t.c_str()...
1
by: v4vijayakumar | last post by:
1. Why the following program is not working as expected? #include <iostream> using namespace std; int main() { string t("test"); wcout << (wchar_t *) t.c_str() << endl; wcout << t.c_str()...
10
bajajv
by: bajajv | last post by:
Hi, I was trying to implement CString with std::string and std::wstring. class CString { public: std::string str; CString() {str = "ABCD";} //this works }: class CString {
3
bajajv
by: bajajv | last post by:
Hi, I want to implement the cstring class using wstring. but in assignement operator, I need to know how to add null while assigning some wchar_t type of data to the wstring. below is my code - ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.