码迷,mamicode.com
首页 > 其他好文 > 详细

int转LPCTSTR

时间:2020-03-31 14:12:09      阅读:69      评论:0      收藏:0      [点我收藏+]

标签:har   char   syntax   printf   form   style   height   静态   cst   

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

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

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

int转LPCTSTR

标签:har   char   syntax   printf   form   style   height   静态   cst   

原文地址:https://www.cnblogs.com/Stephen-Qin/p/12604448.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!