Emperor Sabi avatar

Binary file program

learnandgrow

Published: 05 Feb 2018 › Updated: 05 Feb 2018Binary file program

Binary file program

Program Code

#include
#include
#include
using namespace std;
class theOriginals{
char name[500];
int saireline;
public:
theOriginals(){
strcpy(name,"enter name of Original");
saireline =1000;}
theOriginals(char name,int saireline){
strcpy(this->name,name);
this->saireline=saireline;
}
void whichoriginal(){
cout<<"this is "<<name<<" Mikelson and its sires are about "<<saireline<<endl;
}
};
int main(){
theOriginals original("elijah",4003);
fstream file("originals",ios::binary|ios::in|ios::out|ios::trunc);
if(!file.is_open()){
cout<<"Error occured while opening the file"<<endl;
}else{
file.write((char
)&original,sizeof(theOriginals));
file.seekg(0);
theOriginals vamp("klaus",100000);
vamp.whichoriginal();
original.whichoriginal();
}
}

Made in C++ language

alt

Made in compiler Codeblocks

alt

Leave Binary file program to:

Written by

SCIENTIST, Programmer,Photographer, Entrepreneur & Steemian .

Read more #busy posts


Best Posts From Emperor Sabi

We have not curated any of learnandgrow's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Emperor Sabi