Re: C strtok

matt@nospam.uts.edu.au
Tue, 26 Mar 1996 19:38:06 +1100 (EADT)

Steve Evans wrote this...

> Hey ppl...

> When I use this function I pass a NULL (to indicate use the string
> it already has) and a string of delimiters for the token...

> Ne1 know of any way I can get the delimiter that was actually used
> if it does resolve a token??

> ie my string looks somthing like this to start with :
> BLAH[8] :=
> or it could look like this
> BLAH :=

> I call strtok with a delimiter list of " ["

> I need to know what the delimiter is that is uses...

> Also, I don't have a pointer to the string/token (strtok keeps it to
> itself I believe...) so I can't go about this other ways without a
> little hassle...

no way with standard strtok() you could get the source for it and hack
it yourself, or else write yourself a lexer or get lex(1) to make a
lexer for you. if you do use a lexer you'll probably want to make a
parser as well, in that case either yacc or bison, but this might be a
bit of overkill.

Matt

-- 
#!/bin/sh
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D3F204445524F42snlbxq'|dc;exit
  Matthew Keenan   Data Network Admin   Information Technology Division
        University of Technology     Sydney Australia

It's nice to be in a position where people apologize because they assume there's humor in your work, based on past experience, but they're not sure where it is. -- Rob Pike