Talk:How to read data from a file in Qt
This article is one of the very basic example of QT. Here they used Qfile class for reading data form a file.in Qt Qfile useful for reading from and writing to files.
This class can be used by it self.But hear they used it with QTextStream for displaying Hello.You can check for a file's existence using exists(), and remove a file using remove().
The file is opened with open(), closed with close(), and flushed with flush(). Data is usually read and written using QDataStream or QTextStream so you can use any of this command for making different operation with use of Qt.This article is very useful for beginner.
Application may need to save some text data on client. Flat text file is more suitable in storing large data. Creating a text file and saving text data, in it for later use, is good option. Reading text file is basic operation to use text file. QFile is key API to read data from file in Qt.
The article describes methods to read data from text file. Before opening a file in ReadOnly mode one must check existence of a file, Opening a file in WriteOnly or ReadWrite mode will create a file if the relevant file does not already exist, but ReadOnly mode will gives error if file does not already exist.
Drg0072 -it just shows only first line of file given
15:47, 5 April 2012 (EEST)