怎么互换TCHAR 与 LPCSTR; CString与TCHAR
烦出个点子,谢了先。
烦出个点子,谢了先。
解决方案 »
- 进来看看这个简单的界面排列问题,你们遇到过吗~~(送分)
- 请教ctab控件的问题
- 请问如何设计DLL(带窗体的) —Win32
- 如何初始化新建的DIALOG里的组合框/?
- 如何用vc调出powerpoint的画笔的功能
- 用winsocket类如何下载网页?
- 大侠帮忙:如何实现将void*类型的数据转换为CString类型?顶者有分
- 来帮我个忙,对话框问题
- 怎样才能在我enter键弹起来后才执行?请看!!
- 在VC + ODBC + SQL 7.0的开发中,为什么我无法锁住记录?
- VisualStudio (嗷~~~) 麻烦发一份RTP源码,收到立即给分!:)谢谢
- 请教:如何让CListCtrl里的某一选项接收双击消息
A type cast provides a method for explicit conversion of the type of an object in a specific situation. Syntaxcast-expression :unary-expression
( type-name ) cast-expressionThe compiler treats cast-expression as type type-name after a type cast has been made. Casts can be used to convert objects of any scalar type to or from any other scalar type. Explicit type casts are constrained by the same rules that determine the effects of implicit conversions, discussed in Assignment Conversions. Additional restraints on casts may result from the actual sizes or representation of specific types. See Storage of Basic Types in Chapter 3 for information on actual sizes of integral types. For more information on type casts, see Type-Cast Conversions.
LPCSTR p;
TCHAR a[20];
p = a;
如果不是UNICODE , TCHAR = char, LPCSTR = const char *
如果是UNICODE , TCHAR = WIDE CHAR, LPCSTR = CONST CHAR *
可以用 MULTIBYTETOWIDECHAR / WideCharToMultiByte 互相转换.
TCHAR tc;
CString str = tc;
CSTRING支持UNICODE
w = d.GetBuffer(d.GetLength());
TCHAR *w;
CString d("ssss");
w = d.GetBuffer(d.GetLength());