CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

ascii char to decimal conversion

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








ascii char to decimal conversion
PostPosted: Wed Oct 22, 2008 8:43 am     Reply with quote

This may be a dumb question, but i cant seem to find the solution. I have commands coming in from rs232 and i need to convert the ascii values to decimal values.

"Command01" converted and assigned to
int8 command = 1;

or more simply:
"255" converted and assigned to
int8 command = 255;

I dont see any built in function and dont see how sprintf or printf can help???

Thanks
Guest








PostPosted: Wed Oct 22, 2008 8:49 am     Reply with quote

It's called - atoi() for ASCII to int - this is part of the standard C library and is in every C compiler I have ever seen.

HTH - Steve H
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed Oct 22, 2008 8:51 am     Reply with quote

Look up atoi().
Guest








PostPosted: Wed Oct 22, 2008 8:51 am     Reply with quote

Embarassed

thought there was a simple solution

Thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group