Input from existing text file
if i have a text file with some data and i need to read it...how could i do that using QFile or other Q library...and if i would like too add some line how could i do that without deleting old data???thx =)
You can "read files directly":http://doc.qt.nokia.com/4.7/qfile.html#reading-files-directly or "use stream to read files":http://doc.qt.nokia.com/4.7/qfile.html#using-streams-to-read-files
If you don't use QIODevice::Truncate flag, the file is opened without losing data.
Also look at "text stream description":http://doc.qt.nokia.com/4.7/qtextstream.html#details for writing text files examples.
As always: it depends. Is your file very long? In that case, you may want to read it piece by piece using QTextStream. If it is not too big, you can read it in one go, but I would still use QTextStream (it takes care of some potential issues for you, like line endings).
For appending data (that is: adding at the end), you can open a file in Append mode. See QFile documentation for how to do that. Then you can add to the file. You can not insert in a file without rewriting it.