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 support@ccsinfo.com

How to get a value from a string

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



Joined: 31 Mar 2010
Posts: 10

View user's profile Send private message

How to get a value from a string
PostPosted: Wed May 25, 2011 1:06 am     Reply with quote

hi!, how can i get the value of 1 from

+CMTI: "SM",1 << i want to get it
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Wed May 25, 2011 2:20 am     Reply with quote

Basic programming.
Search for the location of the ',' (strchr).
Then would depend on what is after the '1', and the likely format of the number. If it is always just one digit, you can just subtract '0' from the ASCII value, to get the number. If it is longer, but the string already terminates after it, then an ASCII to numeric conversion, starting at this point (atoi). If however there is a line feed, then you either need to extract the characters, or put a '\0' in place of the line feed.

Best Wishes
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