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. Joe -- PGP Key : http://www.marcuscom.com/pgp.asc
signature.asc
Description: This is a digitally signed message part