V
v4vijayakumar
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() << endl;
wstring t2 = (wchar_t *) t.c_str();
wcout << t2.c_str() << endl;
return 0;
}
2. It is acceptable that there is no conversion from wstring to
string, but,
Why there is no conversion (wstring::wstring(string )) from string to
wstring?
#include <iostream>
using namespace std;
int main()
{
string t("test");
wcout << (wchar_t *) t.c_str() << endl;
wcout << t.c_str() << endl;
wstring t2 = (wchar_t *) t.c_str();
wcout << t2.c_str() << endl;
return 0;
}
2. It is acceptable that there is no conversion from wstring to
string, but,
Why there is no conversion (wstring::wstring(string )) from string to
wstring?