Observe the program segment given below carefully and fill the blanks marked as Line 1 and Line 2 using fstream functions for performing the required task.
#include
class Stock {
long Ino; // Item Number
char Item[20]; // Item Name
int Qty; // Quantity public:
void Get(int);
Get(int); // Function to enter the content
void Show( ); // Function to display the content
void Purchase(int Tqty)
{
Qty+ = Tqty; // Function to increment in Qty
}
long KnowIno( )
{ return Ino;}
};
void Purchaseitem(long PINo, int PQty)
// PINo -> Info of the item purchased
// PQty -> Number of items purchased
{
fstream File;
File.open(“ITEMS.DAT”,ios::binary|ios::in|ios::cut); int Pos=-1; Stock S;
while (Pos== -1 && File.read((char*)&S, sizeof(S)))
if (S.KnowInc( ) == PINo)
{
S.Purchase(PQty); // To update the number of items
Pos = File.tellg()- sizeof(S);
//Line 1 : To place the file pointer to the required position ______________________________________;
//Line 2 : To write the objects on the binary file ______________________________________;
}
if (Pos == -1)
cout<<“No updation done as required Ino not found...”;
File.close( );
}