WAP to to read the text from the file named "hello.txt" to the file name called "test.txt".
Sep 22, 2018Program:
#include<iostream> // for file operations #include<fstream> using namespace std; int main(){ char ch; // now open file in output mode fstream read_file,write_file; // open the test.txt in write mode write_file.open("test.txt",ios::out); // open hello.txt in read mode read_file.open("hello.txt",ios::in); while(1){ // read character from file read_file.get(ch); if(read_file.eof()){ break; } // write the read character to file write_file.put(ch); } write_file.close(); read_file.close(); return 0; }