C++ MFC

Moderators: Lundin
Number of threads: 3354
Number of posts: 9032

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
convert CString Ascii to decimal from serial port Posted by azhari24 on 24 Jul 2011 at 1:40 PM
Hello...
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);	


if I run the program a result is false. I'm sorry I can't speak english fluently... thx
Thread Tree
azhari24 convert CString Ascii to decimal from serial port on 24 Jul 2011 at 1:40 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.