if (edit window text == "a string")

I need to get the text in a edit window and use an if statement. Here is a small amount of code that I am trying to get working:

1
2
3
4
5
6
7
8
TCHAR tText [256];
GetWindowText (GetDlgItem (hwnd, INPUT), tText, 256);
if (tText == "add")
CCommands::Cadd qLol;
else if (tText == "addi")
CCommands::Caddi qLol;
else if (tText == "addiu")
CCommands::Caddiu qLol;


But it doesn't work, later on I have a else statement holding a message box which seems to always be used. Can anyone help me here?
hello CPPProgrammer4L,

you misused 'tText' since it's a pointer. So this if (tText == "add") compares two pointers which are guaranteed to be different. Use strcmp() instead
Thank you so much, I was getting very frustrated with this :P
Topic archived. No new replies allowed.