To convert a string literal to wchar_t
we can use L
like:
wchar_t variable[10] = L"some text"
;`
But if the string is stored inside a variable then how do I convert it to wchar_t
?
Suppose the string is in a variable
string varString="someText";
I want to store it in a variable of type wchar_t
, for example wchar_t var;
How do I type cast and store it?
I want to place the variables inside a loop where their values will change with each cycle:
for(i=0;i<10;i++)
{
var=(*some kind of casting*)varString;
}