|
On Fri, 19 Apr 2002, Nicolay, Paul wrote:
> Funny to know that strtok() is a C function and isn't used in the provided C
> code :-)
Hmm... I didn't even know about the strtok() function. Oh here's why -
from the man page:
BUGS
Never use these functions. If you do, note that:
These functions modify their first argument.
The identity of the delimiting character is lost.
These functions cannot be used on constant strings.
The strtok() function uses a static buffer while
parsing, so it's not thread safe. Use strtok_r() if
this matters to you.
Even the man page for strtok() says not to use it. Now I know why I never
heard of it. But I can't see any difference between strtok() and my
little getword() function, other than strtok() uses a static buffer and
getword() doesn't. That should fix the threadsafe problem.
James Rich
james@eaerich.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.