LPCTSTR类型?
来源:互联网 发布:php开源手机商城系统 编辑:程序博客网 时间:2024/04/27 13:29
LPCTSTR类型?
L表示long指针,这是为了兼容Windows 3.1等16位操作系统遗留下来的,在win32中以及其他的32为操作系统中, long指针和near指针及far修饰符都是为了兼容的作用。没有实际意义。
P表示这是一个指针
C表示是一个常量
T表示在Win32环境中, 有一个_T宏
这个宏用来表示你的字符是否使用UNICODE, 如果你的程序定义了UNICODE或者其他相关的宏,那么这个字符或者字符串将被作为UNICODE字符串,否则就是标准的ANSI字符串。
STR表示这个变量是一个字符串
所以LPCTSTR就表示一个指向常固定地址的可以根据一些宏定义改变语义的字符串。
同样, LPCSTR就只能是一个ANSI字符串,在程序中我们大部分时间要使用带T的类型定义。
LPCTSTR == const TCHAR *
**
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] 了。
- LPCTSTR类型?
- LPCTSTR类型
- LPCTSTR类型
- LPCTSTR类型
- LPCTSTR类型
- LPCTSTR类型
- LPCTSTR类型
- LPCTSTR类型
- LPCTSTR类型
- LPCTSTR 类型
- LPCTSTR类型
- LPCTSTR类型
- LPCTSTR:类型
- LPCTSTR类型
- LPCTSTR类型
- 如何理解LPCTSTR类型?
- 如何理解LPCTSTR类型?
- 如何理解LPCTSTR类型?
- CVS 相关资料
- 各种花代表的意义
- SQL查询语句精华
- 优秀网站源码、编程源码下载网站大集中
- 向汶川受灾人民表示诚挚慰问
- LPCTSTR类型?
- stripcc去除C源代码中未使用的条件编译分枝(转)
- 晕,时间过得真快
- 游戏制作人需要什么样的决断力?
- 永久博客地址:NealBlog.Cn
- 永久博客地址:NealBlog.Cn
- 投机智慧
- 常见数据库分页SQL语句
- delete和delete[] 的区别(转)