I have followed instructions on the net and this code is suppose to add the inputs to the end of the file 'database'. But when i check, the data over rides the existing data. Please help, here is my code:
int main(){
string name;
string address;
string handphone;
cout << "Name: ";
getline(cin, name);
cout << "Address: ";
getline(cin, address);
cout << "Handphone Number: ";
getline(cin, handphone);
ofstream myfile("database", ios_base::ate);
myfile.seekp( 0, ios_base::end );
myfile << name<<endl;
myfile << address<<endl;
myfile << handphone<<endl;
myfile.close();
}