lpcstr与lpctstr的区别

LPCSTR   A 32-bit pointer to a constant character string.
LPSTR   A 32-bit pointer to a character string.
LPCTSTR   A 32-bit pointer to a constant character string that is portable for Unicode and
DBCS.
LPTSTR   A 32-bit pointer to a character string that is portable for Unicode and DBCS
LPWSTR 就是wchar*是支持unicode等双字节的字符是16bits
LPSTR 是char*是ansi单子节8bits
LPCTSTR 是const char*
LPTSTR 是一个宏
#ifdef _UNICODE
#define LPTSTR  LPWSTR
#else
#define LPTSTR  LPSTR
#endif
也就是说当你定义了_UNICODE宏LPTSTR就是LPWSTR
没有定义_UNICODE,LPTSTR就是LPSTR
可以用ATL的W2T,T2W,W2A,A2W,A2T,T2A六个宏转换
char s[20]是20个字节的数组
而char *s只是一个指针他只有16/32/64位字节
从这个意义上char s[20] 相当于 char *s = new char[20];
他们分配内存的位置也不同,特别当char s[20]是全局变量时。
char s[20] 不等于 char *s = new char[20] 了。
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值