File i/o in C++ is quite similar to file i/o in C, the one of the differences is that in C++ you use file streams instead of FILE*. You may want to study this link for Basic file Input and Output in C++. It should help explain basic C++ file input and output.
You say I should do this line by line or I misunderstood?
Originally Posted by blunt
I dunno if c++ is simpler than c mate haha, but i know where you are coming from, - have a look at the faq pages, you will find information and easy examples of file input and output using c++ also if
you go to cplusplus website you can enter 'ifstream' or 'ofstream' into the search and you will get good reference material.
Renting process you need to think about what happens in real life when you rent a movie - if you are not considering the money part and just looking at whether or not your movie is rented then you could just use a boolean member of each movie to say 'isRented' true or false etc. Alternatively you could assign a numberofcopies variable if your shop has more than one of each film - then ++ or -- it when a rental is made.
For the file i/o what exactly is your aim? Do you want to open a file at runtime and read in all the movie information? When you write to a file do you want to be able to add new movies to the catalogue? Do you want to write a history of rentals made and be able to load that on program open?
here is another cboard link with general c++ io instruction - part way down you will see a file write example - bear in mind the example appends to the file in the snippet.
That's pretty much what I want. I need to create my own base with this program, I need to edit this information and in the end, before I go out of the program I want it to be saved (not during adding/deleting objects). Let's put it this way:
Originally Posted by rogster001
Open a program (opening a reading is being done) -> editions, editions, blah blah -> close a program (writing is executed) -> Open a program and so on...
Oh and I forgot: problem with your references, and ALL references is that they involve easy examples like 'how to put a sentence into a file'. I'm standing here in front of a more complex problem, that non of sites (or books) about C++ can explain...