Revision as of 04:17, 11 October 2012 by
How to read data from a file in Qt
From Nokia Developer Wiki
This code snippet demonstrates how to read a file using QFile.
Created:(07 Jan 2009)
Last edited:(11 Oct 2012)
- Make a text file and give full path in the program.
- The following code snippet would read this file and display its content as a text label.
int main(int argc, char *argv)
QApplication app(argc, argv);
file.open(QIODevice::ReadOnly | QIODevice::Text);
QString line = in.readLine();