PDA

View Full Version : writing in text file



ready
3rd July 2011, 17:12
function::

QFile file("input.txt");
file.open(QIODevice::WriteOnly);
QDataStream out(&file);
out << QString("somedata");

I have been able to write in text file with this....
but when I want to add another thing in same text file whenever I call the function for next time .....my previous value gets erased....on text file ,,and i don't want the data to be erased...
please suggest me how to solve this problem??

squidge
3rd July 2011, 17:31
Did you try QIODevice::Append ?

ready
3rd July 2011, 18:09
No I didn't ...and I have very little idea about this...
would you please mind elaborating this??

squidge
3rd July 2011, 22:20
Something like:



file.open(QIODevice::WriteOnly | QIODevice::Append);