Hi all,,

A module of my Bank Management System which should display the user account details after successfuly entering his/her details calls to a function:
Code:


void display_acc(int n)
{
account acc;
int flag=0;
ifstream inFile;
inFile.open("account.txt",ios::in);
if(!inFile)
{
cout<<"File could not be open !! Press any Key...";
return;
}
cout<<"\nBALANCE DETAILS\n";
while(inFile.read((char *) &acc, sizeof(account)))
{
if(acc.ret_acno()==n)
{
acc.show_account();
flag=1;
}
}
inFile.close();
if(flag==0)
cout<<"\n\nAccount number does not exist";
}
where
Code:
void account::show_account()
{
cout<<"\nAccount No. : "<<acno;
cout<<"\nAccount Holder Name : ";
cout<<name;
cout<<"\nType of Account : "<<type;
cout<<"\nBalance amount : "<<&account::deposit;
}
and
Code:
int account::ret_acno()
{
return acno;
}
the name of my class is account which contains public functions declarations and other variables:
But on run it says "File could not be open !! Press any Key..."



What I wanna know is that my account.txt is a text file and contains data in unreadable format except the string values....
1.How should i achieve human readable data format ?
2.Is there any mechanism where i should connect my this C++ program to SQL database where i should create an account table and auto-increment it for users having each users required data and then retrieve on display_acc function i.e on write_acc should enter acc.no,acc.holder name etc and on demand should retrieve it from MYSQL database.
Please ensure me to do so...

account.txt contains data like despite of declaring it *.txt:
ÌÌÌÌÌÌÌÌÌÌÌ° CÌÌÌ ÌÌÌÌÌÌÌÌÌÌ̤ CÌÌÌ ˜E« javed ÌÌÌÌÌÌÌÌÌÌ ÌÌÌÌX SÌÌÌ