我用文本方式接收串口信息,但是收到的信息里有一段二进制数据,我如何才能把这段收下来,从而转换成16进制呢?我不知道这段二进制数据VARIANT型的到底转换成什么类型才对?有没有别的方法
//截取到指定字符串的串口输入信息
strInput.Empty();
while(bl)
{
if(m_Com.GetInBufferCount() > 0)
{
COleVariant m_olevariantStr(m_Com.GetInput() );
m_olevariantStr.vt = VT_BSTR;
strInput += m_olevariantStr.bstrVal;
if(strInput.Find(">") != -1 )
{
AfxMessageBox(strInput);
bl = FALSE;
}
}
else
DoEvents();
}
这里BSTR好像不行了,因为BSTR是unicode的,我的数据里有00
谢谢各位大侠指正。
//截取到指定字符串的串口输入信息
strInput.Empty();
while(bl)
{
if(m_Com.GetInBufferCount() > 0)
{
COleVariant m_olevariantStr(m_Com.GetInput() );
m_olevariantStr.vt = VT_BSTR;
strInput += m_olevariantStr.bstrVal;
if(strInput.Find(">") != -1 )
{
AfxMessageBox(strInput);
bl = FALSE;
}
}
else
DoEvents();
}
这里BSTR好像不行了,因为BSTR是unicode的,我的数据里有00
谢谢各位大侠指正。