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

parsing strings

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



Joined: 19 Feb 2005
Posts: 11
Location: new york usa

View user's profile Send private message

parsing strings
PostPosted: Tue Dec 13, 2005 1:49 pm     Reply with quote

I am trying to parse a variable length string being returned by a barcode scanner. The string can be up to 20 characters long. for example: "<12345>678321". I need to capture only the characters between the "< >" characters.

strncpy(NewStrg, Strg+3,20) will give me the string without he first
"<" .
I have tried this:
valueptr = strchr(NewStrg, '>');
for(x=0; x<valueptr ; x++)
{
NewestStrg[x]=NewStrg[x];
}

but does not give right result.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Dec 13, 2005 2:18 pm     Reply with quote

strchr() returns a pointer, not an index.
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