Describe different methods of operating a file in C ++. Also , example different file open modes. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Describe different methods of operating a file in C ++. Also , example different file open modes.

write a program to copy'first.txt' file to' second.txt' file.

9th Jan 2017, 7:22 AM
munish rastogi
munish rastogi - avatar
1 Answer
+ 3
#include <fstream> using namespace std; int main() { ifstream in("first.txt", ios::binary); ofstream out("second.txt"); char c; while(in.read((char*) &c, sizeof c)) out << c; in.close(); out.close(); }
1st Mar 2017, 3:59 PM
SUPER_S
SUPER_S - avatar