is there an easier way?
Joe Marcus Clarke
marcus at marcuscom.com
Mon Feb 18 23:20:58 UTC 2008
On Mon, 2008-02-18 at 18:19 -0500, Joe Marcus Clarke wrote:
> On Mon, 2008-02-18 at 15:03 -0800, Gary Kline wrote:
> > To my fellow C nerds,
> > It's been a great manny years since I wrote this appended
> > snippet. Now I can't remember why (of if ) I need all the
> > strcpy() calls. Is there a simpler, more logical way of
> > printing a bunch of string by snipping off the left-most?
> > In short,, can anyone 'splain why strtok needs all this?
> Here are two examples, one with dynamically allocated memory, and one
> with static memory. You need the copy so that you allocate writable
> space for strtok() to fill in the NUL bytes. I imagine there are even
> better/easier ways, but both of these work okay.
Posted to http://www.marcuscom.com/downloads/strtokeg.c as the
attachment didn't make it.
PGP Key : http://www.marcuscom.com/pgp.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20080218/4262ec30/attachment.pgp
More information about the freebsd-questions