is there an easier way?
Giorgos Keramidas
keramida at ceid.upatras.gr
Tue Feb 19 00:47:02 UTC 2008
On 2008-02-18 17:41, Tim Daneliuk <tundra at 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.
More information about the freebsd-questions
mailing list