Hi folks, I had created a class for student. This is the class.
class student
{
int rollno,marks;
char name[20];
public:
void show();
void get();
int filecreate(const string &,fstream &);
int fileopen(const string &,fstream &);
static int add(const student &,fstream &);
static int read(const student &,fstream &,int);
static int update(const student &,fstream &,int);
int showall(fstream &);
int view(fstream &,int );
int adddummy(fstream &);
};
This is my add method to write a record in the binary file.
int student::add(const student &s,fstream &fp)
{
fp.seekp(0, ios::end);
if(fp.write((char*)&s,sizeof s))
return 1;
return 0;
}
If i write the values of the object s, What are the values written to the file. Is it only rollno, marks and name (Data members only ?). Now i want to add a member for fstream. after adding the member, if i write the file, what data will write into the file (will the fstream values also write to file?)