in C++ by (10.9k points) edited by
0 like 0 dislike
18 views

How I can to work with wchar_t data type in C++?

1 Answer

0 like 0 dislike
by (10.9k points)

No way. Work with std::wstring and then convert std::wstring to const wchar_t* with help c_str() method of std::wstring when this necessary. For convert other (predominantly numeric) types in std::wstring use std::to_wstring() methods.

Example

int foo = 5;
double bar = 15.25;
float cnt = 124.532f;
std::wstring some = L"some";
std::wstring txt = L"text";
std::wstring tot = some + L" " + txt + L" " + std::to_wstring(foo) + L" " + std::to_wstring(bar) + L" " + std::to_wstring(cnt);
const wchar_t* full = tot.c_str();

Your answer

Try to answer the question as detailed as possible.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.