#include<iostream> #include<fstream> #include<string> using namespace std; int main() { char ch[100]; string str; ofstream outFile; ifstream inFile; cout<<"Enter the file your want copy to:"<<endl; cin.getline(ch,100); inFile.open(ch); if(!inFile.is_open()) { cout<<"something was wrong, open failure! exit%%%%%"<<endl; exit(EXIT_FAILURE); } strcat(ch,"copy.txt"); outFile.open(ch); while(getline(inFile,str)) { outFile<<str<<endl; } inFile.close(); outFile.close(); return 0; }