You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, July 11th 2010, 11:19am

Merging files (*.001, *.002 etc.)

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?

2

Sunday, July 11th 2010, 4:50pm

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;