Advertisement Remove all ads

Find the Output of the Following C++ Code Considering that the Binary File Clients.Dat Exists on the Hard Disk with a Data of 200 Clients: - Computer Science (C++)

Find the output of the following C++ code considering that the binary file CLIENTS.DAT exists on the hard disk with a data of 200 clients:

class CLIENTS
{
    int CCode; char CName[20];
public:
    void REGISTER(); void DISPLAY();
};

void main()
{
    £stream File;
    File.open("CLIENTS.DAT", ios::binary|ios::in);
    CLIENTS C;
    File.seekg(6*sizeof(C));
    File.read((char*)&C, sizeof(C));
    cout<<"Client Number: "<<File.tellg()/sizeof(C) + 1;
    File.seekg(0 , ios :: end) ;
    cout<<"of"<<File.tellg(}/sizeof(C)<<endl;
    File.close();
}
Advertisement Remove all ads

Solution

Client Number: 7 of 200

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?
Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×