I've got a problem with merging files. I don't know how to join files like: *.001, *.002 etc. from (for example) Total Commander using C++. Have you hot any ideas or suggestions?
Well how do you want to merge the files? Do you simply want to append the last one to the first one? In that case it would be:
|
Source code
|
1
2
3
4
5
6
7
8
9
|
#include <QtGui>
QTextStream file1(QFile(/*filename here*/));
QTextStream file2(QFile(/*filename here*/));
QString text1 = file1.readAll();
QString text2 = file2.readAll();
QString finalText = text1.append(text2);
QTextStream finalFile(QFile(/*filename here*/));
finalFile << finalText;
|