1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

search qustion

Discussion in 'C' started by hoda, Jul 3, 2009.

  1. hoda

    hoda New Member

    Joined:
    Feb 17, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    in my program,i give each user an ID code but maybe user forget ID, then i want to search his or her name in a way that if i print part of the user's name ,program shows me all of names which have that part then i choose between them.
    how can i do that??
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    strstr is a useful function for finding a substring.
     
  3. hoda

    hoda New Member

    Joined:
    Feb 17, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    but with strstr we can find the exact name.i want to type part of the name then compiler shows me all of the names with this part then i can choose.
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    No, you're thinking of strcmp. strstr is a function that finds substrings of a string, so if you give it the parameters "look it up in the docs bozo" and "docs" then it will give you a pointer to "docs", thus confirming that "docs" is indeed in the string.
     

Share This Page