I have a WCHAR[]:
WCHAR foo[200];
I want to copy values into it:
if (condition)
{
foo = L"bar";
}
else
{
foo = L"odp";
}
What is the best way to do this?
wcscpy
, although the superbest thing would be to use std::wstring
instead.
std::wstring foo;
if (condition)
foo = L"bar";
else
foo = L"odp";
Or if you insist on using wcscpy
:
WCHAR foo[200];
if (condition)
wcscpy(foo, L"bar");
else
wcscpy(foo, L"odp");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With