Question:
Find the output of the following C++ code considering that the binary file CLIENT.DAT exists on the hard disk with a data of 1000 clients.
class CLIENT
{
int Ccode;char CName[20];
public:
void Register();void Display();
};
void main()
{
fstream CFile;
CFile.open(“CLIENT.DAT”,ios::binary|ios::in);
CLIENT C;
CFile.read((char*)&C, sizeof(C));
cout<<”Rec:”<<CFile.tellg()/sizeof(C)<<endl;
CFile.read((char*)&C, sizeof(C));
CFile.read((char*)&C, sizeof(C));
cout<<”Rec:”<<CFile.tellg()/sizeof(C)<<endl;
CFile.close();
}
C. Sir| Created: 1-Jan-2019 | Updated: 22-Mar-2026|CBSE12A-2016
