WideCharToMultiByte(...)
看看msdn吧
看看msdn吧
解决方案 »
- VC不弹起来的按钮要怎样实现?
- SDI程序为了不让其在开始运行后FileNew,则改变了cmdInfo(cmdInfo.m_nShellCommand==FileNothing),可是这样就在winocc.cpp 329行文件中
- 我需要一个可编辑的datagrid控件,怎么办呢?
- 奇怪,关闭一个网页会引起所有的网页关闭
- 请帮忙 CTreeView 中的鼠标双击事件?谢谢
- 做拉好久都没做出来
- 请教大虾们 有关跟踪算法的问题?
- 处理一张24位的彩色图像,程序运行后图像压缩显示了,请教各位
- 请问成员函数的调用方式与普通函数的调用方式有何不同
- 串口编程中怎样用函数:WaitCommEvent(...) ???
- 定义在winuser.h中的API调用出错,why?
- 如何把浏览目录对话框功能加入到自己的对话框中,自己从头写除外。
所以可用以下函数:atoi, _atoi64 解释: Convert string to int
格式:
#include <stdlib.h> int atoi( const char *string ); __int64 _atoi64( const char *string );
itoa, _i64toa, _itow, _i64tow 解释: Convert int to string
格式:char *_itoa( int value, char *string, int radix );
参数说明: value Number to be converted string String result radix Base of value; must be in the range 2 – 36
CString strTemp="test";
BYTE* pTemp=(LPBYTE)strTemp.GetBuffer(0); //第二种 CString To LPBYTE
CString strTemp2="test2";
BYTE byTemp[50];
memcpy(byTemp,strTemp2,strTemp2.GetLength());
byTemp[strTemp2.GetLength()]='\0'; //第三种 CString To LPBYTE
CString strTemp3="test3";
LPBYTE pTemp2=new BYTE[strTemp3.GetLength()];
memcpy(pTemp2,strTemp3,strTemp3.GetLength());
pTemp2[strTemp3.GetLength()]='\0'; //...............................................
//第一种 LPBYTE to CString
CString strTemp4;
strTemp4.Format("%s",(LPCSTR)pTemp2); //第二种 LPBYTE to CString
CString strTemp5;
strTemp5=(LPCSTR)pTemp2;以上5种相互转换方式够你用的了。
Good Luck
可惜分都给了。只能在这里表示深深的感谢了。 :)
char szBuf[1024];正向: BSTR bstr=m_strDisplay.AllocSysString();逆向: int nRet=WideCharToMultiByte(
CP_ACP,
WC_COMPOSITECHECK,
bstr,
nLen,
szBuf,
sizeof(szBuf), NULL,NULL);
szBuf[nRet]='\0';//转换回来时不包括空结束符
直接用
Buf[i]=Buf[i]-128;
那肯定是对地址进行操作了,而不是对值进行操作了。不知道是不是这样,如果是的,
那应该具体怎么样来做呢?谢谢各位。