Hi,
I am trying to read values from a text file and make it to display in the lineEdit box, i have used the code below but it is not working out.


void MainWindow:n_start_clicked()
{
QString str;
QFile file("sp.txt");
if (!file.open(QIODevice::ReadOnly))
{
QTextStream in(&file);
in >> str;
file.close();
}

ui->lineEdit->setText(str); // this is for displaying the values in the line edit box
}


i have also used this connect function in the constructor
connect(ui->start,SIGNAL(clicked()),this,SLOT(on_start_clicke d()));

start is the object name of the push button..
i have also included the header QtextStream

The text file contains values as
23
34
44

kindly do please help me out!!