How a integer data can be send to serial port.I am using MSCOMM in vc++ 6.0 for serial communication and also i have to send data in hexa format.I written the code but it is not working properly.My code is
UCHAR ID=0x10;
CHAR buffer[20];
int iposition,idistance;
Cstring str,pstr,dstr;
iposition=10;
idistance=5;
str.Format("%c",ID);
pstr.Format("%c",iposition);
dstr.Format("%c",idistance);
str=str+pstr+dstr;
for(int i=0;i < str.GetLength();i++)
buffer[i] = str[i];
BSTR bstr=SysAllocString((OLECHAR *)buffer);
VARIANT var;
ZeroMemory(&var,sizeof(VARIANT));
var.vt=VT_BSTR;
var.bstrVal =bstr;
m_mscom.SetOutput(var);//Variant By Reference
SysFreeString(bstr);
Is it correct way to send or not please give the solution.