|
|
View previous topic :: View next topic |
Author |
Message |
fedetouz
Joined: 01 Aug 2007 Posts: 14
|
i need eliminate characters <CR><LR> |
Posted: Thu Aug 16, 2007 4:53 pm |
|
|
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
|
|
Posted: Fri Aug 17, 2007 12:03 pm |
|
|
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
|
|
Posted: Sat Aug 18, 2007 1:42 pm |
|
|
Thanks! PCM, i see all clear right now!, i try this now thanks again! |
|
|
|
|
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
|