Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C Moderated > Re: Parsing?
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 5 Topic 1008 of 1133
Post > Topic >>

Re: Parsing?

by Tim Brown <timbrown@[EMAIL PROTECTED] > Jan 12, 2008 at 04:42 PM

lisp9000@[EMAIL PROTECTED]
 wrote:

> 
> I thought of using strtok() but that doesn't handling quoting so if I
> encounter a message in " " it won't be able to handle it.
> 
> Does anyone have any idea on the best way to tokenize this? My goal is
> to extract only certain types of messages such as the ones between
> players (eg. Z1->P0) and to the team message board (eg P0->TEAMPURPLE)
> and put these into HTML files in time increasing order.
> 

Have you thought of using strtok() and detecting the quotes yourself?

If a token ever has an odd number quotation marks in it, then you can get 
the remaining chars of the quoted string with a call to strtok(NULL,"\""),

like getting the second half of the quoted string.  The two tokens making 
up the quoted string can be recombined by replacing the '\0' terminating 
the first of the tokens with a ' '.  Since the terminating quotation mark 
will be replaced with '\0' in this case, any token with an odd number of 
quote marks in it will be understood to have a terminating quote mark 
appended.

Will the log file ever contain an unmatched quotation mark?

Wi****ng a better idea would come to me, but alas, I am not an expert
either.

Tim
-- 
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
 -- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line.  Sorry.
 




 5 Posts in Topic:
Parsing?
"lisp9000@[EMAIL PRO  2007-09-21 05:15:38 
Re: Parsing?
WillerZ <newsreplies@[  2008-01-12 16:41:39 
Re: Parsing?
Tim Brown <timbrown@[E  2008-01-12 16:42:40 
Re: Parsing?
user923005 <dcorbit@[E  2008-01-12 16:44:25 
Re: Parsing?
Barry Schwarz <schwarz  2008-01-12 16:46:56 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 2:04:44 CDT 2008.