C++ Programming Blog

 
 
 
# include <iostream.h>
# include <conio.h>
# include <fstream.h>

class machine
{
    char name[10];
    long int phone;
    public:
    void getdata()
    {
        cout<<\"ENTER THE NAME:->\";
        cin>>name;
        cout<<\"\\nENTER THE PHONE NUMBER:->\";
        cin>>phone;
    }
    void show()
    {
        cout<<\"\\nTHE NAME IS:->\"<<name;
        cout<<\"\\nTHE PHONE NUMBER is:->\"<<phone;
    }
};

main()
{
machine m;
fstream file;
file.open(\"data\",ios::ate|ios::in|ios::out|ios::binary);
file.seekg(0,ios::beg);

cout<<\"\\nTHE CONTENTS OF FILE ARE.\\n\";
while(file.read(char *)&m,sizeof(m))

 
 
Didn't find what you were looking for? Find more on Program that provides an example of binary files