At last my program to transfer content of one file to another. Here is the full program for further reference to other users.
Code:
#include<fstream.h>
#include<iostream.h>
#include<conio.h>
class student
{
int rollno;
char name[20];
int tm;
public:
	void input();
	void transfer();
	void output();
	};
void student::input()
{
char ch='y';
ofstream outf;
outf.open("mark.dat");
while(ch=='y')
{
cout<<"Enter rollno, name and mark\n";
cin>>rollno>>name>>tm;
outf.write((char*)this,sizeof(student));
cout<<"Wish to enter more(Y/N)?\n";
cin>>ch;
}
outf.close();
}
void student::transfer()
{
ofstream outf;
ifstream inf;
inf.open("mark.dat");
outf.open("trans.dat");
while( inf.read(( char* )this,sizeof(student))) 
{
outf.write(( char* )this,sizeof( student ) );
}
outf.close();
inf.close();
}
void student::output()
{
ifstream inf;
inf.open("trans.dat");
while (inf.read((char*)this, sizeof(student)))
{
cout<<"\nRollno "<<rollno;
cout<<"\tName "<<name;
cout<<"\tTotal "<<tm<<'\n';
}
inf.close();
}
void main()
{
clrscr();
student obj;
obj.input();
obj.transfer();
obj.output();
getch();
}