You seem to have a funny problem eh,well once you really have file handling in your hands you will look back and laugh.
Ok first the rand() does not return any random numbers but ones form a array so you must use the srand(...) to seed the array.[I dont know if you are aware].
Now to file handling.
You use c++ so I assume you use fstream.Ok now rather than reading 7 lines of chars from the file use dynamic file access on a binary file.
To open a file in binary mode
file.open("name_of_file",ios::in|ios::out|ios::binary);
Dynamic File Acess Funtions.(They move the file pointer in bytes)
file.seeg();
file.seekp();
Hey you might already know this so wont go into detail(If you dont just post an i'll explain)
ok now store diffrent menu items is a structure like:
struct menu
{
char name[100];
char whatever;
int whatever;
}
This will enable us to use dynamic access easily as all the structure variables are of the same size.To find the size of any data type.
cout<<sizeof(data_type);//size in bytes
So if you use structures the size if always the same.So if struct is 5 100 bytes in size the first record will start at byte zero,second on byte hundred and so on.So this can be used to calculate the location fo the data and move the pointer there.Use the following formula.[The 1st rec is 0 not 1,similar to arrays]
file.seekg(rec_no*sizeof(strcture),ios::beg);
file.read((char*)&var,sizeof(strcture)); //to read
/*file.write((char*)&var,sizeof(strcture));//to write */
Now you can dynamically read,write,and modify.[Modification involves reading a rec,allowing the user to modfy it and re-write the rec in the same place].
It's quite easy but many have a problem with modifiction(I dont know why).
[Also post some of your code to get some pointed answers] :idea: