I have an array of strings as follows:
char *sCmdInt[8];
I am filling this array by tokenizing a line of text from a file. I then want to check if element 0 of the array is equal to a value.
Eg:
if (sCmdInt[0] == "ReadMemory32")
{
// do stuff
}
When debugging, I can see that the values are equal, but it doesn't evaluate to true for some reason; it just skips to the next statement.
I tried using strcmp also:
if (strcmp(sCmdInt[0], "ReadMemory32"))
{
// do stuff
}
but this causes an access violation as sometimes there won't be anything in sCmdInt[0].
I have tried first checking if sCmdInt[0] is null also
if (sCmdInt[0] == NULL)
// also
if (sCmdInt[0] > 0)
// also
if (&sCmdInt[0] == "")
// and other combinations
but this didn't work either.
I tried storing the two variables as pointers and then using strcmp but still getting an access violation.
Somebody please help!!