MFC数据类型转换
来源:互联网 发布:电脑实时监控软件 编辑:程序博客网 时间:2024/05/20 04:11
CString->int
CString str("1234");
int i= _ttoi(str);
CString->const char*
const char* CXmlCtrl::cstoc(CString s)
{
int len = WideCharToMultiByte(CP_UTF8, 0, s, s.GetLength(),NULL, 0, NULL, NULL);
char * c = new char [len + 1];
len = WideCharToMultiByte(CP_UTF8, 0, s, s.GetLength(), c, len+ 1, NULL, NULL);
c[len] = 0;
return (const char*)c;
}
WCHAR*->char*
void CXmlCtrl::w2c(char *pcstr,const wchar_t *pwstr, size_tlen)
{
int nlength=wcslen(pwstr);
//获取转换后的长度
int nbytes = WideCharToMultiByte(0, 0, pwstr, nlength, NULL,0, NULL, NULL );
if(nbytes>len) nbytes=len;
// 通过以上得到的结果,转换unicode 字符为ascii 字符
WideCharToMultiByte(0, 0, pwstr, nlength, pcstr, nbytes, NULL,NULL );
}
0 0
- MFC数据类型的转换
- MFC----数据类型转换
- MFC数据类型转换
- mfc 数据类型转换一
- MFC中常用数据类型转换
- MFC中常用数据类型转换
- MFC 数据类型转换(二)
- MFC简单数据类型类及其转换
- C/C++与MFC数据类型转换
- MFC简单数据类型类及其转换
- MFC中各种数据类型的转换
- MFC中数据类型转换的一些心得
- [C++ VC MFC] VC常用数据类型使用转换
- MFC中其他数据类型转换为CString类型
- 在MFC中各种数据类型之间的转换
- MFC----Cstring 与 int、float、double 数据类型的相互转换
- MFC中常用数据类型之间的相互转换
- MFC数据类型
- 一元一次方程
- css中行内元素padding,margin,width,height说明
- 安卓Activity的启动与清除
- 安卓通过Intent传递自定义类
- 安卓体系结构
- MFC数据类型转换
- vs2010下配置qt开发环境
- ubuntu下安装qt5.1
- ubuntu下qt4.7.3交叉编译环境的搭…
- qt错误修改记录
- mplayer交叉编译
- 交叉编译gstreamer
- dm8168下qt界面与视频的同步显示
- java.lang.NoClassDefFoundError: Java/Test