use of wchar_t

I'm not able to understand this variable type. Please let me know it's function and also how to use it?

//practising variable types

#include <iostream>
using namespace std;


int main()

{
wchar_t m ("A");
cout << m;
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
using namespace std;


int main()

{
wchar_t *m = L"A";
wcout << m;
return 0;
}
adding on to the post above ^

wchar_t can store unicode stuff such as chinese/korean characters. However, there are some things u need to take note of:

1) when assigning values, put a "L" in front of it like wchar_t *m = L"A"
2) change ur cout function to wcout instead (applies to wstring too)
3) there's a wstring library for wide chars which works pretty much the same as string library
4) consoles cant display most unicode character so try putting ur stuff into a text file to test it out
#include <iostream>
using namespace std;


int main()

{
wchar_t *m = L"A";
wcout << m;
return 0;
}

this gave me error message "deprecated conversion from string constant to 'w_chart *'', please help.
It's for unicode. But good God, you have to do a heck of a lot to get the console to output unicode characters properly, in case you are using it.
Topic archived. No new replies allowed.