I need to save data the user input to a dat file, I got a description of an item, price, quantity my code is this, it doesn't save the data though
void saveInventory()
{
ofstream outfile;
outfile.open("inventory.dat", ios::binary);
if(!outfile.is_open()){
cout<<"File openning error."<<endl;
return;
}
outfile.write((char*)&items, sizeof(items));
outfile.close();
}