Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID


We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

convert CString Ascii to decimal from serial port

azhari24azhari24 Posts: 3Member
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++)
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.