How to open a text file in QT creator using either QFile or fstream

480 Views Asked by At
QFile file("D:/QT/employee manager ui/EmployeeManager/‪employeeLogIn.txt");
if(!file.open(QIODevice::ReadOnly))
{
    QMessageBox::information(0, "info", file.errorString());
}

I tried to use fstream, and ifstream to open the the file in QT creator, but I could not open the file. I used both back slash and double forward slash while specifying the file location. Last night, my code ran, but doesn't open the file.

This project has qmake build system, and QT widget application

thank you!

0

There are 0 best solutions below