添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

TCHAR is either char or wchar_t depending on whether you are building for UNICODE or not. So maybe your are building for UNICODE but coding for a non-unicode character set.

To convert char to wchar_t (UTF-16LE) -

You can call the C library function mbstowcs-s-mbstowcs-s-l

Another option is to call the Windows API function nf-stringapiset-multibytetowidechar

In addition to what others have correctly told you - if you're starting out with an ANSI string, your application is never going to be able to handle characters that are outside your code page. This may not be an issue for you, but if you might encounter file names with foreign characters, you should really address the source of the problem such that you can support all file names that Windows can - which means changing the source char * to be TCHAR * too.