I have a problem when i am writing into files in a binary format.I have noticed that, it writes two times into the file. Here i have attached the code.
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
class bank
{
protected:
char receive[20];
public:
}
int main()
{
fstream file;
strcpy(receive,"hello");
file.open("binary.my",ios_base::in | ios_base::out | ios_base::binary | ios_base::app);
file.write(reinterpret_cast<char*>(&receive),sizeof(receive));
file.close();
return 0;
}