Untitled
unknown
plain_text
3 years ago
665 B
1
Indexable
Never
7 string line; 8 string input_name; 9 ifstream myfile; 10 cout<<"Source file: "; 11 cin>>input_name; 12 myfile.open(input_name); 13 if (myfile.is_open()) 14 { 15 /* 16 while ( getline (myfile,line) ) 17 { 18 cout << line << '\n'; 19 } 20 */ 21 string dstfile; 22 ofstream myfile2; 23 cout<<"Destination File: "; 24 cin>>dstfile; 25 myfile2.open(dstfile); 26 while (getline(myfile, line)) 27 { 28 myfile2<<line<<'\n'; 29 } 30 myfile.close(); 31 myfile2.close(); 32 } 33 34 else cout << "Unable to open file"<<endl; 35 36 return 0; 37 }