How to initialize _TCHAR array
-
Hi, i'm looking for a way to initialize a static array of _TCHAR elements. I've tried the following code in the StdAfx.h file. //BEGIN OF CODE static const _TCHAR * enDayOfWeek_DaysStrings[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturady" }; //END OF CODE When _UNICODE is not defined, it works great. But when _UNICODE is defined, i get a compiler error: "error C2440: 'initializing' : cannot convert from 'const char [7]' to 'const _TCHAR *'. Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast" Any ideas?
-
Hi, i'm looking for a way to initialize a static array of _TCHAR elements. I've tried the following code in the StdAfx.h file. //BEGIN OF CODE static const _TCHAR * enDayOfWeek_DaysStrings[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturady" }; //END OF CODE When _UNICODE is not defined, it works great. But when _UNICODE is defined, i get a compiler error: "error C2440: 'initializing' : cannot convert from 'const char [7]' to 'const _TCHAR *'. Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast" Any ideas?
-
"" tells the compilter it is a non-unicode string. You should be using _T("Sunday"), or L"Sunday" if you are sure the application will be using unicode for certain.