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

i need eliminate characters <CR><LR>

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



Joined: 01 Aug 2007
Posts: 14

View user's profile Send private message

i need eliminate characters <CR><LR>
PostPosted: Thu Aug 16, 2007 4:53 pm     Reply with quote

Hi all, i have the respond of the gsm module like this:

Code:

<CR><LF>
170.51.251.112<CR><LF>



i store this on buffer string, the problem is that i need eliminate CR and LF characters ,and send the numbers to other string.

I need some help
Thanks!


sorry for my english!!!
Fede
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 17, 2007 12:03 pm     Reply with quote

Quote:
I store this on buffer string, the problem is that i need eliminate CR and LF characters ,and send the numbers to other string.


Is this a string ? Does it have a zero byte at the end, to make it a string ?

If so, then use the strlen() function to get the length of the string.
Then use a for() loop to step through each byte in the string, and
copy each one to another buffer. Inside the for() loop, read a char
from the first buffer, and use an if() statement to check if the char
is either a CR or a LF. If so, then skip copying that character to
the 2nd buffer. Also, when you finish copying the chars to the 2nd
buffer, make sure you write a zero byte at the end, so it will become
a string.
fedetouz



Joined: 01 Aug 2007
Posts: 14

View user's profile Send private message

PostPosted: Sat Aug 18, 2007 1:42 pm     Reply with quote

Thanks! PCM, i see all clear right now!, i try this now thanks again!
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