Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Leda > Filing problem!
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 189 of 212
Post > Topic >>

Filing problem!

by "Ebi" <khademi@[EMAIL PROTECTED] > Feb 2, 2005 at 05:03 PM

It's a main function of club program in Borland c++ 5;
There is a film class in my club program...
But I have a problem with it: whenever I add a film by addfilm function
to film.dat file, data(objects) that I add before remove, and there is
an object available at per time. And I can't add more than one film,
because the previous film object remove.
Please help me.

//********************************************** 1.addfilm *=AD*
void addfilm()
{
film film1;
film1.setstate(1);
ofstream fp("film.dat", ios::binary);
if(!fp) {
cout<<"Cannot open file."<<endl;
system("PAUSE");
exit(0); }
cout<<endl;
film1.puttitle();
film1.setid();
cout<<"Enter Artists: ";
cin>>film1.artists;
cout<<"Enter Director: ";
cin>>film1.director;
cout<<"Enter Company: ";
cin>>film1.company;
cout<<"Enter Producer: ";
cin>>film1.producer;
cout<<endl;

fp.seekp(sizeof(class film)*film1.getid(), ios::beg);
fp.write((char*)&film1, sizeof(class film));=20
    fp.close(); }




 2 Posts in Topic:
Filing problem!
"Ebi" <khade  2005-02-02 17:03:41 
Re: Filing problem!
hall <XandreashX@[EMAI  2005-02-09 17:49:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 7:23:43 CDT 2008.