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

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!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source