gotcha in strtok(3)

Henry Spencer henry at utzoo.uucp
Thu Feb 25 18:13:02 AEST 1988


>      The remedy is to copy the variable into a local or static
> buffer and run strtok(3) from that, leaving the environment
> alone.

Better yet, actually, is to malloc space for it.  That saves you from
having to make assumptions about how long it can be.
-- 
Those who do not understand Unix are |  Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly.    | {allegra,ihnp4,decvax,utai}!utzoo!henry



More information about the Comp.lang.c mailing list