Just seeing this!! Sorry about that Jim!!
ofstream file(file_name); ... file.close(); ... file.open(file_name, ios::in); ... file<<id_no<<qoh<<price;
You have created an instance of an ofstream, this can only be used for output. Try using an fstream instead. Then you won't need to open and close the file to do input and output to this stream.
ok, I will try this!!