i want to copy the contents of one file to another file.But using the following code only first line is copied;
Qt Code:
while(!f.atEnd()) { in>>q; out<<q; } f.close(); f1.close();To copy to clipboard, switch view to plain text mode
i want to copy the contents of one file to another file.But using the following code only first line is copied;
Qt Code:
while(!f.atEnd()) { in>>q; out<<q; } f.close(); f1.close();To copy to clipboard, switch view to plain text mode
Last edited by high_flyer; 7th February 2011 at 11:54. Reason: code tags
Why don't you use QFile::copy?
how is 'q' defined?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
q is of type QString.i want to copy line by line,so that i can get some details seperated from the file.
q is of type QString.i want to copy line by line,so that i can get some details seperated from the file.
1. Operator >> reads word not line.
2. Use QTextStream::readline.
@Leisok: thanks... i also wanted to know how to write the data line by line..
Did you try using operator << ?
Bookmarks