source file name: copyfile.cpp
contents of first file
wel come to DBJ college
also Computer Science department
#include <iostream.h>
#include<stdio.h>
#include<conio.h>
#include <fstream.h>
int main()
{
ofstream fout;
fout.open("two.txt");
const int N=80;
char line[N];
clrscr();
ifstream fin;
fin.open("one.txt");
// cout<<"contents of file\n";
while(fin)
{
fin.getline(line,N);
fout<<line<<endl;
cout<<line<<endl;
}
cout<<"this contents copy into second file\n";
fin.close();
fout.close();
getch();
return 0;
}
output:
0 Comments
Post a Comment