int转LPCTSTR

最省事儿的,就是用CString中转一下:

1
2
3
4
int  i = 10;
CString str;
str.Format(_T( "%d" ),i);
LPCTSTR  pStr =  LPCTSTR (str);

另外,_stprintf也比较方便,并自动适应字符集,但需要申请内存并做静态转换(因为LPCTSTR的意思是Const常量TCHAR子适应字符STR串指针)。

猜你喜欢

转载自www.cnblogs.com/Stephen-Qin/p/12604448.html