Thread: what is the use of strstr function

  1. #1
    Registered User
    Join Date
    Mar 2013
    Location
    Vadodara
    Posts
    2

    what is the use of strstr function

    hey can anyone tell me that in C program what is the use of strstr function is?????

  2. #2
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    open browser, go to google.com. search for 'strstr'

  3. #3
    Registered User
    Join Date
    Mar 2013
    Location
    Vadodara
    Posts
    2
    Quote Originally Posted by Harshdesai View Post
    hey can anyone tell me that in C program what is the use of strstr function is?????
    Quote Originally Posted by dmh2000 View Post
    open browser, go to google.com. search for 'strstr'
    hey thanks for telling but i have found but i don't getting the exact meaning n its excat use of it?
    if u know than can u tell me???

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    strstr - C++ Reference

    Can u read?

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  5. #5
    Stoned Witch Barney McGrew's Avatar
    Join Date
    Oct 2012
    Location
    astaylea
    Posts
    420
    Suppose you want to check whether there are any web links in a string, you could do:

    Code:
    const char *str = "abcdefghijklmnop http://foo.bar qrstvuwxyz", *sp;
    
    if ((sp = strstr(str, "http://"))) handle_link(sp);
    In this case a pointer to the substring, "http://foo.bar qrstvuwxyz" will be stored in sp. The best way to understand how strstr works would be to implement it yourself, although I'd suggest starting with strchr first.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help with strstr() function
    By zacavitch in forum C Programming
    Replies: 13
    Last Post: 10-12-2009, 02:14 AM
  2. strstr and utf-8
    By MK27 in forum C Programming
    Replies: 2
    Last Post: 02-01-2009, 10:54 PM
  3. need help with strstr function for microcontroller
    By Lince in forum C Programming
    Replies: 2
    Last Post: 08-07-2008, 08:47 AM
  4. Replies: 14
    Last Post: 03-02-2008, 01:27 PM
  5. about strstr()
    By heeroyung in forum C Programming
    Replies: 6
    Last Post: 10-07-2005, 12:45 PM