Binary file program original style
programming·@learnandgrow·
0.000 HBDBinary file program original style
# Program Body #include < iostream > #include < cstring > #include < fstream > 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 Written in C++  Compiled in Codeblocks  # Programming is magic 