Try setting "use unicode" in your projects settings in VS if you want _tcslen
to be wcslen
, set it to "use multibyte" for _tcslen
to be strlen
. As some already pointed out, _t
prefixed functions (as many others actually, e.g. MessageBox()
) are macros that are "expanded" based on the _UNICODE
precompiler define value.
Another option would be to use TCHAR
instead of WCHAR
in your code. Although I'd say a better idea would be to just stick to either wchar_t
or char
types and use appropriate functions with them.
And last but not least, as the question is tagged c++, consider using std::string
(or std::wstring
for that matter) and std::vector
instead of char buffers. Using those with C API functions is trivial and generally a lot safer.