I have the following code which functions correctly.
if((strcmppgm2ram((char*)name, (ROM char*)"products.htm") != 0))
{
if((strcmppgm2ram((char*)name, (ROM char*)"restock.htm") != 0))
{
return HTTP_IO_DONE;
}
}
I'd like to clean it up and put it in the form:
if((strcmppgm2ram((char*)name, (ROM char*)"products.htm") != 0) || (strcmppgm2ram((char*)name, (ROM char*)"restock.htm") !=0))
{
return HTTP_IO_DONE;
}
Unfortunately, the latter is not working correctly. What have I overlooked?? Thanks in advance! P.S. strcmp == strcmppgm2ram for the sake of this question.
You are using ||
when you should be using &&
.
The result should only be reached if BOTH conditions are true.
The reason it didn't work before is because even if one of the strings matched, the other one wouldn't, so regardless of input the statement would always result in returning HTTP_IO_DONE
.