Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2008 02:46:52 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Tim Daneliuk <tundra@tundraware.com>
Cc:        Gary Kline <kline@thought.org>, freebsd-questions@freebsd.org
Subject:   Re: is there an easier way?
Message-ID:  <20080219004652.GD5362@kobe.laptop>
In-Reply-To: <47BA17B6.20906@tundraware.com>
References:  <20080218230351.GA28000@thought.org> <47BA1375.2010108@tundraware.com> <47BA14F8.4060109@tundraware.com> <47BA17B6.20906@tundraware.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2008-02-18 17:41, Tim Daneliuk <tundra@tundraware.com> wrote:
> Tim Daneliuk wrote:
>> Ooops ... wasn't paying attention.  While the printed output is the
>> same, doing it this way is destructive to the original s1 string -
>> which may matter (or not)...
> 
> So, to protect the original string, you do have to copy the original
> string to a new buffer:

... or use strcspn() and strspn() which are non-destructive
(see my other post in the same thread about an example).

I tend to prefer avoiding strtok() if possible, precisely because
of its destructive behavior.




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