我现在用VC编基于AT命令的串口通信软件,已经实现了收发英文短信,但是中文短信的收发解决不了,各位帮帮忙,分不够可以再加!
解决方案 »
- 请问 在dll中调用log4cplus出现内存访问冲突,而直接在exe中调用log4cplus没有问题,这时怎么回事?
- 抢楼获奖,散分!。。。。。。。。。。。。。。。。。。。。。。。。
- CXTPReBar和 CXTButton 的问题
- 菜鸟的送分贴,请大虾进
- char* pChar=strJkbm.GetBuffer(); 怎么会出错阿 说是'GetBuffer' : function does not take 0 parameters?????
- 有关Winsock的问题
- 为什么我的dreamweaverMX在win2k的添加删除中不能反安装呢?还有就是用code design中全是双引号
- 一进windows系统就自动运行的程序,如何设置它们自动运行的先后顺序。
- toolbar上得按钮可不可以在视图里加响应函数?还是必须在主框架CMainFrame里??
- 文本文件的写入与写出的问题
- 我的程序在2k和xp下运行没问题,在98下出问题了,求救
- 现在OICQ的信息报文看不懂啊
使用MultiByteToWideChar(CP_ACP, 0, temp1.GetBuffer(0), -1, mid, 2);
把你传递的字符串转换成UNICODE编码就可以了 如果还不知道
看下面的
CString EncodeChinese(CString InputStr)
{
int cur;
CString tempstr,returnstr;
CString ws,temp1;
WCHAR mid[2];
ws.Format("%s", InputStr);
cur=ws.GetLength();
for(int i=1;i<=ws.GetLength()/2;i++)
{ temp1=ws.Mid((i-1)*2,2);
MultiByteToWideChar(CP_ACP, 0, temp1.GetBuffer(0), -1, mid, 2);
cur=mid[0];
tempstr.Format("%4.4x",cur);
returnstr=returnstr+tempstr;
}
return returnstr;
}
CString DecodeChinese(CString InputStr)
{
WCHAR Buf[300];
char Buf1[600];
CString temp1;
char temp2[20],*end;
int pos;
pos=InputStr.GetLength()/2;
memset(Buf1,0x00,600);
for(int i=0;i<InputStr.GetLength();i=i+4)
{
temp1=InputStr.Mid(i,4);
memcpy(&temp2[0],temp1.GetBuffer(0),4);
Buf[i/4]=(int)strtol(temp2,&end,16);
}
Buf[InputStr.GetLength()/4]=0;
WideCharToMultiByte(CP_ACP,0,Buf,-1,Buf1,pos,NULL,NULL);
temp1.Format("%s", Buf1);
return temp1;
}
就OK了
就可以了?
CString 就认了吧
或者_T("string")是否就行了?
不对啊!我发的是“你好”,手机上收到的是4f60597d.我是用MScomm控件的这条命令发送的:
m_ctrlComm.SetOutput(COleVariant(cEncode));cEncode的类型是CString,用于接收文本框的输入内容。
+CMGL: 6,"REC UNREAD","+8613802146687",,"02/12/27,09:08:14+00"
6211我如何才能将其中的6211提取出来?