cebin
7th February 2011, 11:47
i want to copy the contents of one file to another file.But using the following code only first line is copied;
QFile f("/root/Desktop/n.txt");
f.open(QIODevice::ReadOnly | QIODevice::Text);
QFile f1("nn.txt");
f1.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream in(&f);
QTextStream out(&f1);
while(!f.atEnd())
{
in>>q;
out<<q;
}
f.close();
f1.close();
QFile f("/root/Desktop/n.txt");
f.open(QIODevice::ReadOnly | QIODevice::Text);
QFile f1("nn.txt");
f1.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream in(&f);
QTextStream out(&f1);
while(!f.atEnd())
{
in>>q;
out<<q;
}
f.close();
f1.close();