hi
i have created a class named BANK having three variables .i have created a object B . now using a function i want to store the corresponding values in a file.also using another function i want to read all the variables from the file.and want to print them in the console .for eg.

#include<iostream.h>
#include<fstream.h>
#include<iomanip.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>

fstream fs;

class bank
{
private :
int no;
char name[15];
int bal;
public :
void getdata();//to read the variables
void wwrite();//to write in a file
void putdata();//to print in a console
void rread();//to read from a file
};
void bank :: getdata()
{
cout << "\nenter the no name and balance\n";
cin >> no >> name >> bal;
}
void bank :: putdata()
{
cout << "\nno\t: "<<no << "\nname\t: "<<name << "\n bal\t: "<< bal;
}

//to write inside a file

void bank:: wwrite()
{
fs.open("c:\\files\\e8.txt",ios::app);
fs.write((char *)&this,sizeof(this));
fs.close();
}

void bank::rread()
{

fs.open("c:\\files\\bank.txt",ios::in);
while (!fs.eof())
{
fs.read((char *)br,sizeof(br));
cout <<"\n" << br.no << "\t" << br.name;
}
fs.close();
}

void bank :: putdata()
{
cout << "\nno\t: "<<no << "\nname\t: "<<name << "\n bal\t: "<< bal;
}
void main()
{
clrscr();
bank b;// creating an object for bank;
while(1)
{
cout << "\n1.Add a new account
2.Deposit\n
3.Withdraw\n
4.View account detail\n
5.exit\ ";

int cas;
cin >> cas;// to get the options 1/2/3/4/5;
switch(cas)
{
case 1: //1.Add a new account
clrscr();
b.getdata();//to get datas from kwy board
b.wwrite();//to write inside a file
break;
case 2: //2.Deposit
case 3: //3.Withdraw
case 4: // 4.View account detail";
clrscr();
b.rread() ;
b.putdata();
break;
case 5: exit(0);
}
}
getch();
}
// the problem is using wwrite() iam able to write inside the file. (not sure). but iam not able to retrive it using the rread() function. please find a solution for me. thanks.