void CMy123Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString temp1;
char buf1[]={0x31,0x11,0x0D,0x91,0x68,'\0'};
temp1=buf1; //(1)
CString temp2;
char buf2[]={0x31,0x00,0x0D,0x91,0x68,'\0'};
temp2=buf2; // (2)
}
buf1和buf2唯一的不同是:buf1[1]=0x11,buf2[1]=0x00,执行后temp1是{0x31,0x11,0x0D,0x91,0x68,'\0'},而temp2只有0x31!
为什么0x00赋不进去???
我的目的是要把0x31,0x00,0x0D,0x91,0x68 放到CString中!
{
// TODO: Add your control notification handler code here
CString temp1;
char buf1[]={0x31,0x11,0x0D,0x91,0x68,'\0'};
temp1=buf1; //(1)
CString temp2;
char buf2[]={0x31,0x00,0x0D,0x91,0x68,'\0'};
temp2=buf2; // (2)
}
buf1和buf2唯一的不同是:buf1[1]=0x11,buf2[1]=0x00,执行后temp1是{0x31,0x11,0x0D,0x91,0x68,'\0'},而temp2只有0x31!
为什么0x00赋不进去???
我的目的是要把0x31,0x00,0x0D,0x91,0x68 放到CString中!
memcpy(temp2.GetBuffer(数组长度), buf2, 数组长度);
temp2.ReleaseBuffer(数组长度);
你知道0x00='\0'嘛?
现在知道了!谢谢!0x00 怎么放到 CString中?
如果:放入的串中有许多零散的0x00! 向下列的情况:(每两个前加一个0x)
0891683108100005F0040D91683196533746F600F620010312130002710464026F050005000401241736999999241737000000241737123E452417381234E62417381E2345241738432E77241739345E99241739234E782417401E23542417403234E82417412134E724174144E444241742111111241742222222241743333333241743444444FFFFFFFF1A9803, 有什么好办法!
如果:我的目的是要把0x00,0x00,0x00,0x,0x00 放到CString中!
我的问题得到圆满的解决!
谢谢大家!
准备结了!