Question: ```
struct student
{
int identity;
char name[MAX];
int no_assessment;
char assessmenttask[MAX];
int mark;
};

void appendbfile(char filename [MAX])
{
ofstream writeb;
char filenameb [MAX];
strcpy(filenameb,filename);
student s;

strcat(filenameb,".dat");

cout<<"--------------------------------"
    <<endl
    <<"Begin appending for binary file " 
    <<filenameb
    <<endl
    <<endl;

cout<<"Enter student id: ";
cin>>s.identity;

cout<<"Enter student name: ";
cin>>s.name;

writeb.open(strcpy(filenameb,".dat"),ios::binary);

writeb.seekp(0,ios::end);

writeb.write (reinterpret_cast <const char *>(&s), sizeof (s));

writeb.close();

}

```

I can run the programme but i cant seem to append a record to the binary file. Can someone help me take a look.

Thanks

Answer: 
You need to pass the `ios::app` flag to the open function:

```
 writeb.open(filenameb, ios::binary | ios::app);

```
You also need the ios::app ORed in the open function.