C++ program to append content of one text file to another
Given source and destination text files. Append the content from source file to destination file and then display the content of destination file.
Input : file.txt : "geeks", file2.txt : "geeks for" Output: file2.txt : "geeks for geeks"
1) Open file.txt in inputstream and file2.txt in outputstream with append option, so that the previous content of file are not deleted.
2) Check if there’s an error in opening or locating a file. If yes, then throw an error message.
3) If both the files are found, then write content from source file to destination file.
4) Display the content of destination file.
geeks for geeks