From: Rob Zook <rzook@informix.com>
Subject: Re: Strange errors from strtok()
Date: Mon, 01 Dec 1997 14:16:45 -0600 [thread overview]
Message-ID: <665372104d044459ef5ece7931d3194e.axp-list@archive.invalid> (raw)
In-Reply-To: <19971201115108.03468@dot.cygnus.com>
At 11:51 AM 12/1/97 -0800, you wrote:
>On Mon, Dec 01, 1997 at 01:03:09PM -0600, Rob Zook wrote:
>> I'm trying to use the strtok function from stdlib in a program and
>> I get these strange errors:
>
>Except that strtok isn't in <stdlib.h>, but in <string.h>.
<snip>
Yup, adding "include <string.h>" to my program removed the compile
warnings, but I still got the strange behavior in my loop.
When I tested this cgi, the postline string had a value of
"name=Rob+Zook&extension=1111&guest=yes&beverage=beer"
tokenPtr = strtok(postline,"&");
do
{
printf("<B>TokenPtr</B> = %s<BR>\n", tokenPtr);
}
while((tokenPtr = strtok(NULL,"&"))==NULL);
-----------------------------------------^^
And I goofed here. I should have said !=NULL. Haven't had to use a
do-while loop in a while.
Thanks to all who helped!
Rob Z.
--------------------------------------------------------
Not reaching a goal on a given day does not preclude
reaching it tomorrow, or next year. One failure does not
mean all is lost. Let it be motivation to improve, to
deliver optimum performance in the next undertaking,
whatever it may be - not to give up and quit trying.
-- Capt. Spock
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next parent reply other threads:[~1997-12-01 20:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <19971201115108.03468@dot.cygnus.com>
1997-12-01 20:16 ` Rob Zook [this message]
1997-12-01 21:09 Strange errors from strtok() Przemek Klosowski
[not found] <199712012014.NAA14201@ellpspace.math.ualberta.ca>
1997-12-01 20:37 ` Rob Zook
1997-12-01 22:15 ` Michal Jaegermann
[not found] <01bcfe7f$60288060$323ccbd0@zeke.bainet.com>
1997-12-01 19:03 ` Rob Zook
1997-12-01 19:51 ` Richard Henderson
1997-12-01 20:14 ` Michal Jaegermann
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox