Important: Please read the Qt Code of Conduct -

Problem with printing Details in txt File

  • hi in consol every thing in txt will be shown.
    now i want to show in textBrowser but will show me nothing
    @void MainWindow::on_pushButton_clicked()
    QFile times("e:\time.txt");;
    QTextStream MyStream(&times);
    QString MyLine;

            MyLine  = MyStream.readLine();

    What must i do?

  • Lifetime Qt Champion



    You replace the content of textBrowser at each iteration.

    On a side note, you don't check that the file opened successfully which is bad idea since it might not be found.

    Also with Qt you can use the unix notation on all platform i.e.
    @QFile times("e:/time.txt")@

Log in to reply