F
F
Flysink2017-11-19 23:11:49
Qt
Flysink, 2017-11-19 23:11:49

How to merge 2 txt files into one qt?

Text files can weigh 2, 4 GB, it will not work to keep such a volume in memory
using copy /Y 1.txt + 2.txt result.txt or type *.txt > result.txt
but how can this be done through QFile, QTextStream ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2017-11-20
@Flysink

You can read one file first, and then write it to the final file, then the second file, and append it to the final one. You can just read the files piece by piece and add to the final one. QTextStream has a method to read a certain number of characters, and a method to check if there are more characters in the file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question