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.


|