How to combine multiple text files into one ?
-
Now i have lots of text files in a folder,i want to combine them into one large file,but the problem is that it is must be order the formation rule. for instance:(the txt file order) the first text file list item"1c.txt,2c.txt,......... the second text file list item"1e.txt,2e.txt,........ now the combine file order must be "1c.txt,1e.txt,2c.txt,2e.txt........." and so on! Waiting for ur help! Thx advance!;P
Don't try it, just do it! *Archibald*rever dragon!
-
Now i have lots of text files in a folder,i want to combine them into one large file,but the problem is that it is must be order the formation rule. for instance:(the txt file order) the first text file list item"1c.txt,2c.txt,......... the second text file list item"1e.txt,2e.txt,........ now the combine file order must be "1c.txt,1e.txt,2c.txt,2e.txt........." and so on! Waiting for ur help! Thx advance!;P
Don't try it, just do it! *Archibald*rever dragon!
algo : - find all file names to be combined - add each name to a vector of strings (with the strings being the file names) - write your functor to be used to sort the files list the way you like - use std::sort with your functor - create a new empty file - read each file in the order of the sorted vector and add its content at the end of the new file just created at the previous step - dont forget to close all remaining opened files. you got it
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
algo : - find all file names to be combined - add each name to a vector of strings (with the strings being the file names) - write your functor to be used to sort the files list the way you like - use std::sort with your functor - create a new empty file - read each file in the order of the sorted vector and add its content at the end of the new file just created at the previous step - dont forget to close all remaining opened files. you got it
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
thank u very much! i know how to do it!:-O
初学者!Don't try it, just do it! *Archibald*rever dragon!