Hi
my name is Peter and I'm looking for somebody who can help me to understand how to read from external file without "destroing" existing inforamtion inside.
whole staff is based on book example which i'm trying to extend.
I have a programm which is working with database of 3 three accounts.
There is no problem to do operation on it(Deposit, Withdraw) and update data file. However if I insert there on start extra line which state how many accounts are there everything gets funy :(
data file
3 accounts
123 100.0
840 123.5
666 823.9
first number is account number second is current balance
and here is part of code which is looking for information on first line "3"
ifstream accfile;
accfile.open("accounts.dat");
int na; //number of accounts
accfile >> accs[1].accno;
cout << accfile << endl;
getline ( accfile, na);
cout <<"Number of accounts = " << na << endl;
give me error : no matching function for call to `getline (ifstream &, int &)'
if I declare na as string
cout brings "Numbers of accounts = accounts"
this does erease first line