At 08:26 PM 1/6/98 +1100, you wrote: >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. I don't know why you think this is what you're seeing, but the documented behavior of strstr() is that it will return NULL if the needle is not within the haystack, or the pointer to the needle within the haystack otherwise. Perhaps you should get into gdb and look at your variables at the time strstr() is called to verify what you think is happening really is. > >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! Email help and book re-writing too, novel concept :) +------------------------------------------------------------+ | 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