Page 1 of 1

problem with text input from user

PostPosted: Wed Jun 11, 2008 12:09 am
by cyber ruler
so, i have a textbox the user types into (it's for passwords), and it's not working the way it should, i think.
I have it so when the user presses enter, it runs this:
Code: Select all
if (passinput.text == "password")
{
    ...
}

I thought this would work, but it didn't.
I also tried this, which is how you do it in most programming languages:
Code: Select all
if (passinput$ == "password")
{
    ...
}

so... anyone know how to do this *cough* *sgtsparky* *cough* *makslane* *cough*

Re: problem with text input from user

PostPosted: Wed Jun 11, 2008 2:55 am
by pyrometal
You have to use strcmp() to compare strings. It returns 0 when the strings are equal, therefore, use the "!" in front of it to get a "true"(aka: 1) value for your if statement to proceed.

Code: Select all
if( !strcmp(passinput.text, "password"))
{
    ...
}