关于字符串
来源:互联网 发布:linux重命名文件夹命令 编辑:程序博客网 时间:2024/06/06 03:07
1,_T宏和不使用_T宏的区别
MessageBox("你好")在Unicode版本的程序里面不能通过编译,因为MessageBoxW不能用ANSI的字符串作参数,MessageBox(_T("你好"))就可以。
当定义了UNICODE 或_UNICODE时, _T() 就相当于L"",也就是说把括号里的字符变成了16B字符。
2,LPSTR,LPWSTR and LPTSTR
LPSTR Pointer to a null-terminated string of 8-bit Windows (ANSI) characters.
LPWSTR Pointer to a null-terminated string of 16-bit Unicode characters. For more information.
LPTSTR is An LPWSTR if UNICODE is defined, an LPSTR otherwise.
LPCSTR,LPCWSTR and LPCTSTR 就是多了一个constant属性。
3, CString, LPSTR, char* 的转换
char*转换成CString
char chArray[] = "This is a test";
LPTSTR p = _T("This is a test");
CString theString ;
theString = p; // 直接
theString = chArray;// 直接转换
theString.format(_T("%s"), chArray); // 用format
CString转换成chLPTSTR
LPTSTR lpsz =(LPTSTR)(LPCTSTR)theString; // 强转换
LPTSTR p = s.GetBuffer(); // 这样可以修改
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串和数组字符串
- 关于MYSQL字符串
- 关于C++字符串
- 关于PostgreSQL的字符串
- 关于字符串的复制
- 关于字符串的总结
- VS2005(c#)项目调试问题解决方案集锦
- SSH,telnet终端中文显示乱码解决办法
- SUN被收购了。。。Unix——Center立马就发邮件。。。
- 文件下载方法
- 关于c++标准库的一些知识
- 关于字符串
- 我对c++输入输出流的理解
- 浅析国内汽车制造企业流程与ERP需求
- C++是如何利用虚函数实现多态性的?
- 电脑族好菜
- 宽字符集(unicode)操作函数 (转)
- IT进入三国时代
- iPhone软件开发之Interface Builder
- 构建一个图