Need a project done?

C++ Programming Developer

Search This Blog

Copy contents of One File to another C++

'Copy file in C++' program is given below.
Copies content of file 'a' to file 'b'.

#include <iostream>
#include <fstream>
using namespace std;

int main(){
char line[100];

ifstream is("a.txt");
ofstream os("b.txt");

if (is.is_open()){
while (!is.eof()){
os << line << endl;
cout << "a.txt couldn't be opened. Creat and write something in a.txt, and try again." << endl;

return 0;

See a better program:
Copy one file to another file C++
"Don't let anyone ever make you feel like you don't deserve what you want."