Well, you could do something with strspn and pointer addition ;) In this case, you should only work with copies of the original string so you don't destroy the original. There may be some compiler dependent functions that will do what you want (I seem to recall seeing some functions that do, but can't find the man pages for them on my Solaris system here at work). >---------- >From: - Pure Krome -[SMTP:pure@SPRINT.COM.AU] >Sent: Tuesday, January 06, 1998 4:26 AM >To: CIRCLE@POST.QUEENSU.CA >Subject: [NEWBIE]StrStr question again > >Hi All, > just another pathetic question about strstr. How can it be done to >check for a substring (char *needle) in the haystack (char *haystack), >where it will WILL return the char a pointer to the beginning of the >substring in this case ... > >Haystack is - "here is some sentecne with the nameblahblah over here." >Needle is - "name" > >result will be - "nameblahblah". > >The strstr returns NULL for the above example, which is not what i want. > >OH! Thanks for all the answers telling me to use STRSTR. I couldn't find >it in my "The C Programming Language - 2nd Edition by Kerny + Richie). >It's in there now!!!! THANKS! > >J. > > > +------------------------------------------------------------+ > | Ensure that you have read the CircleMUD Mailing List FAQ: | > | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | > +------------------------------------------------------------+ > +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST