本文介绍了如何转换char *到TCHAR []?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

char*  stheParameterFileName = argv[1]; //I'm passing the file name as  a parameter.
TCHAR szName [512];

如何将 char * code> TCHAR [] ?

How can I convert char* to TCHAR []?

推荐答案

如果包括头文件:

#include "atlstr.h"

然后你可以使用A2T宏如下:

Then you can use the A2T macro as below:

// You'd need this line if using earlier versions of ATL/Visual Studio
// USES_CONVERSION;

char*  stheParameterFileName = argv[1];
TCHAR szName [512];
_tcscpy(szName, A2T(stheParameterFileName));
MessageBox(NULL, szName, szName, MB_OK);

这篇关于如何转换char *到TCHAR []?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 22:01
查看更多