Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Feb 2008 18:20:55 -0500
From:      Joe Marcus Clarke <marcus@marcuscom.com>
To:        Gary Kline <kline@thought.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: is there an easier way?
Message-ID:  <1203376855.32200.23.camel@shumai.marcuscom.com>
In-Reply-To: <1203376747.32200.21.camel@shumai.marcuscom.com>
References:  <20080218230351.GA28000@thought.org> <1203376747.32200.21.camel@shumai.marcuscom.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-lXjXtbXt6hp/Mu7osSjH
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


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,
> >=20
> > 	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=20
> > 	printing a bunch of string by snipping off the left-most?
> >=20
> > 	In short,, can anyone 'splain why strtok needs all this?
>=20
> 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

--=20
PGP Key : http://www.marcuscom.com/pgp.asc

--=-lXjXtbXt6hp/Mu7osSjH
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (FreeBSD)

iEYEABECAAYFAke6EtYACgkQb2iPiv4Uz4cmTwCglFtzFUTT0f+9ZsOpKrUsNoGX
ep0An0K+yDBn0rmwWmAq35upoG0pkxWn
=b8nv
-----END PGP SIGNATURE-----

--=-lXjXtbXt6hp/Mu7osSjH--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1203376855.32200.23.camel>