Binary file program

in busy •  7 years ago 

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

Made in compiler Codeblocks

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!