i want to copy the contents of one file to another file.But using the following code only first line is copied;
Code:
while(!f.atEnd()) { in>>q; out<<q; } f.close(); f1.close();
Printable View
i want to copy the contents of one file to another file.But using the following code only first line is copied;
Code:
while(!f.atEnd()) { in>>q; out<<q; } f.close(); f1.close();
Why don't you use QFile::copy?
how is 'q' defined?
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 << ?