Question:
Find the output of the following C++ code considering that the binary file MEM.DATΒ exists on the hard disk with a data of 1000 members.
class MEMBER
{
int Mcode;char MName[20];
public:
void Register();void Display();
};
void main()
{
fstream MFile;
MFile.open("MEM.DAT",ios::binary|ios::in);
MEMBER M;
MFile.read((char*)&M, sizeof(M));
cout<<"Rec:"<<MFile.tellg()/sizeof(M)<<endl;
MFile.read((char*)&M, sizeof(M));
MFile.read((char*)&M, sizeof(M));
cout<<"Rec:"<<MFile.tellg()/sizeof(M)<<endl;
MFile.close();
}
C. Sir| Created: 10-Jan-2019 | Updated: 1-Apr-2019|CBSE12D-2016
