Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


convert CString Ascii to decimal from serial port

azhari24azhari24 Member Posts: 3
I Have a MFC application and I want to convert CString Ascii to decimal from serial port. this my source code :

int dcount=0;
CString data[4];
VARIANT in_dat;

if( m_comm.GetCommEvent()==2)
in_dat = m_comm.GetInput();
CString strInput(in_dat.bstrVal);

if(strInput == "*")
for(dcount=0; dcount<=2;dcount++)<br /> {
in_dat = m_comm.GetInput();
CString strInput(in_dat.bstrVal);

data[dcount] = strInput;
int z = atoi(data[0]); // convert ascii to decimal
int x = atoi(data[1]);
int c = atoi(data[2]);
m_Total.Format("%s%i%i%i | %s%s%s%s",strInput,z,x,c, strInput,data[0],data[1],data[2]);

UpdateData(FALSE); [/code]

if I run the program a result is false. I'm sorry I can't speak english fluently... thx
Sign In or Register to comment.