Ok, first things first. Start by creating a structure to replicate a row in the datafile.
struct INVENTORY
{
INVERNTORY() { memset(this, 0, sizeof(INVENTORY)) ; } ;
char Title[51] ;
char Forename[33] ;
char Surname[33] ;
double Price ;
...
} ;
Then create a list manager (LM) class to store the results in. I've already posted some code in the forum (if you can't find it let me know). As a result of this the following assumes that you are using this code as the basis for your LM.
Once you have written / modified your LM you then open the file and read in a row at a time, inserting the rows into the LM.
Using the methods of the LM you will be able to search for books using Author, ISBN, etc. (Assuming you write the methods.) Overloading the << operator will allow you to print the results to screen or file.
Adding a new book to the list simply requires the user to enter the informtion and then calling the Add method of the LM, again overloading the >> will help you here.
Sorry Prof., but I don't quite see the logic in deleting a book from the list when it goes out of stock, since in theory new stock could arrive at anytime! Anyway, since it's a requirement simply call the Remove method of the LM with the appropriate index.
Now, so that your changes persist you'll need to implement a Dump or Write method for your LM. This would simply iterate over the list items and write them to disk, overwriting the existing datafile.
This of course may be a long process depending on the size of your inventory, but there are ways to get round this, but I'll leave that as an exercise for you.
The only real issue here is the printing of an ordered list. If the file is in alphabetical order then no problems, but if it's not....
In my opinion the best approach would be to order the list at the time of insertion into the LM, by modifying the Add() method. You could do it later once the list was loaded but that may not be practical.
If you need any further assistance then please ask, well be more than willing to help.
FYI I tested the list manager code with 18+Mb of data and 1M+ rows, it took 6secs.
HTH
William
Software Engineer
ICQ No. 56047340