Re: [htdig3-dev] Tearing apart a URL from a certain point on.


Subject: Re: [htdig3-dev] Tearing apart a URL from a certain point on.
From: Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Date: Fri Apr 07 2000 - 10:33:40 PDT


According to Patrick:
> strstr(haystack,needle) only allows my search string to be a single
> character. I am wondering if anyone could help me do something like
> this:
>
> char *needle_position = strstr(ref,'cart_id')
>
> ..to return the position of that search string within ref. Thanks
> in advance.

No, strstr() looks for a substring within a string. strchr() looks for
a single character. However, strings must be in double quotes. You want
something like

    char *needle_position = strstr(ref, "&cart_id");
    if (needle_position)
        *needle_position = '\0';

Do this after the anchor is stripped off.

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------ To unsubscribe from the htdig3-dev mailing list, send a message to htdig3-dev-unsubscribe@htdig.org You will receive a message to confirm this.



This archive was generated by hypermail 2b28 : Fri Apr 07 2000 - 08:18:49 PDT