I'm trying to compare user text input from an iphone app with the text in a static array I have declared. It is always returning "true", even when the text is different. After doing the strncmp, I display both text fields. To the human eye, they are what I expect the fields to be. The debugmsg I return to the screen shows what I expect the values to be, but the compare is always coming up true. Any suggestions would be appreciated. Thanks.
if (strncmp(SymbolEntered.text,
[NSString stringWithCString:elements_table2[idx].element_symbol],2)==0)
{
DebugMsg.text = [NSString stringWithCString:"Correct answer"];
}
else
{
DebugMsg.text = [NSString stringWithCString:"Incorrect!"];
}
DebugMsg2.text = SymbolEntered.text;
DebugMsg3.text = [NSString stringWithCString:elements_table2[idx].element_symbol];