Find the output of the following C++ code considering that the binary file MEMBER.DAT exists on the hard disk with records of 100 members :
c1ass MEMBER
{
int Mno; char Name[20];
pub1ic:
void In();void Out();
};
void main()
{
fstream MF;
MF.open("MEMBER. DAT" , ios::binary|ios::in);,
MEMBER M;
MF.read((char*)&M, sizeof(M));
MF. read( (char*) &M, sizeof (M));
MF. read ((char*) &M, si:zeof (M));
int POSITION= MF. te11g 0 / sizeof (M);
cout<<"PRESENT RECORD:"<<POSITION<<end1;
MF.c1ose();
}
Advertisement Remove all ads
Solution
Present Record: 3
Concept: Binary File in C++ :- Creation of File, Writing Data into File, Searching for Required Data from File, Appending Data to a File, Insertion of Data in Sorted File, Deletion of Data from File, Modification of Data in a File
Is there an error in this question or solution?
APPEARS IN
Advertisement Remove all ads