Hi,
at a given time in a program I am developing, I need to concatenate several text files, and place the result in a new one.
Is there an efficient way of doing this?
Thank
This is a discussion on concatenate text files within the C++ Programming forums, part of the General Programming Boards category; Hi, at a given time in a program I am developing, I need to concatenate several text files, and place ...
Hi,
at a given time in a program I am developing, I need to concatenate several text files, and place the result in a new one.
Is there an efficient way of doing this?
Thank
Since you can copy a file with essentially one line
while ( fgets( buff, sizeof buff, fin ) != NULL ) fputs( buff, fout );
What do you mean by efficient?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
. . . or rather
Code:while(in >> c) out << c;
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Or using rdbuf.