hi i am developing a small Qt gui-application problem here is that i am not able to compare two std strings. In Qt how can i compare two strings.. here is that button code snippet...

in the below code i am simply creating a login page please suggest any alternatives as soon as possible....

void MainWindow:n_pushButton_clicked()
{
stud s1[10];
int flag=0;

string name=ui->lineEdit->text().toStdString();
string pass=ui->lineEdit_2->text().toStdString();
if(pass=="")
{
QMessageBox q1;
q1.setText("PASSWORD CANNOT BE BLANK");
q1.exec();
}
else if(name=="")
{
QMessageBox q1;
q1.setText("NAME AND PASSWORD CANNOT BE BLANK");
q1.exec();
flag=0;
}
//opening file and reading data
ifstream fib;
fib.open("stud.txt");
for(int j=0; j<4; j++)
{
fib>>s1[j].user_name>>s1[j].pass;

}
fib.close();

for(int i=0; i<4; i++)
{
//probably this is not working
if((name==s1[i].username) && (pass=s1[i].pass))
{
flag=1;
}
else
{
flag=0;
}
}

if(flag==1)
{
QMessageBox q1;
q1.setText("VALID-USER");
q1.exec();
MainWindow1 *w=new MainWindow1();
w->show();
this->close();
}
else
{
QMessageBox q1;
q1.setText("INVALID-USER");
q1.exec();
ui->lineEdit->clear();
ui->lineEdit_2->clear();
}
}
thanks.............