sorry , my type here is wrong
node is my class so the e is the name to call the class
int main ()
{
node e ;
...
...
..
}
Code:
int main ()
{
node w ;
total q;
nade e;
char op;
int id ,c,m;
long int pass;
ifstream out;
out.open("out.dat",ios::binary);
if (!out )
{
cout << " file could not be opened ... " << endl;
exit(1);
}
do {
n--;
cout << "enter the id : \a";
cin >> id;
cout << " entar your password:\a";
cin >> pass;
out.seekg((id) * sizeof(node),ios::beg);
out.read(reinterpret_cast <char * > ( &(w)) , sizeof (node ));
w.print();
if ( !(w.getpass()==pass))
{
cout << " your password is wrong ";
}
else
{
ifstream out ;
out.open("out.r",ios::binary);
if (!out )
{
cout << " file could not be opened ... " << endl;wait(1);
exit(1);
}
for ( int i =0 ;i<3;i++)
{
out.seekg((i+1) * sizeof(nade),ios::beg);
out.read(reinterpret_cast <char * > ( &(e)) , sizeof (nade ));
e.print();
} w.print();
cout << endl;
system("CLS") ;
cout << " do you want to continue ( y \n )" << endl;
cin >> op; }while (op!='n'&&op !='N');
out.clear();
out.seekg(0);
for ( int i =0 ;i<3;i++)
{
out.seekg((i+1) * sizeof(nade),ios::beg);
out.read(reinterpret_cast <char * > ( &(e)) , sizeof (nade ));
e.print();
}
return 0;
}
in the first time the data is ok
but in the next thre are no output