I can see that i can cast a string type to LPCWSTR in a parameter like this:
myfunc(L"mystring");
But suppose i want to pass a string as a variable this time, how would i cast it with ease like above (not converting the variable):
string myStringVar = "mystring";
myfunc(myStringVar);
I tried a few things like:
myfunc(L{mystringvar});
If you want to use a wide string you need a std::wstring
. You could use it like
std::wstring myStringVar = L"mystring";
myfunc(myStringVar.c_str());