I'm newbie in C. I want to compare string that I use '#DEFINE' and char buf[256]. This is my code.
#define SRV_SHOWMENU "SRV_SHOWMENU"
#define SRV_LOGIN_TRUE = "SRV_LOGIN_SUC"
#define SRV_LOGIN_FAIL = "SRV_LOGIN_FAIL"
#define SRV_REGISTER_OK = "SRV_REGISTER_SUC"
#define SRV_REGISTER_FAIL = "SRV_REGISTER_FAIL"
char buf[256]; // buffer for client data
...
...
...
...
...
...
if(strcmp(buf,SRV_SHOWMENU) == 0 || strcmp(buf,SRV_REGISTER_FAIL) == 0)
{
}
My C compiler tell me the systax error that "../src/server.c:417: error: expected expression before ‘=’ token". But if I change to "if(strcmp(buf,SRV_SHOWMENU) == 0)" just one compare is ok.
Thank you.