You are using open to open the same file in save and save1. This is unnecessary anyway, as the constructors open the text files anyway. Also, you should make it a habit of checking to see if the text files have been successfully opened, and if not print an error message and quit (or something to that effect).