I have the following:
DYNAMIC_TIME_ZONE_INFORMATION dtzRecorder;
GetDynamicTimeZoneInformation(&dtzRecorder);
I normally do the following to copy a new name:
StringCchCopy(dtzRecorder.TimeZoneKeyName, 128, L"GMT Standard Time");
But now I need to do the following:
char tzKey[51];
std::string timezone("someTimeZOneName");
strncpy_s(MyStruct.tzKey, timezone.c_str(), _TRUNCATE);
StringCchCopy(dtzRecorder.TimeZoneKeyName, 128, MyStruct.tzKey); <--Error
But I get the error:
argument of type "char *" is incompatible with parameter of type "STRSAFE_LPCWSTR"
How can I copy this to dtzRecorder.TimeZoneKeyName??
The basic problem is that
dtzRecorder.TimeZoneKeyNameis a wide string (wchar_t[]), buttzKeyis a narrow string (char[]).The easiest way to solve it would be to use
wchar_tfortzKey, too: