String Comparison

Started by
0 comments, last by Daishim 22 years, 9 months ago
I''m trying to see if a character array contains certain phrase or word, how do I check a character array for this ie...
  

if(String1 == "Quit")
{
     break;
}

  

I know only that which I know, but I do not know what I know.
Advertisement
use strcmp().

it returns zero if the strings are the same, so some people like to do a little #define to make the syntax nicer....

#define StringMatch(a,b) (strcmp(a,b) == 0)

This topic is closed to new replies.

Advertisement