InventoryFileSystem.open("Inventory.dat", ios:
ut | ios::binary);
while(intWritingIndex < 10)
{
// Move back to the beginning of this record's position.
InventoryFileSystem.seekp(intWritingIndex * sizeof(record), ios::beg);
// Write the new record over the current record.
InventoryFileSystem.write(reinterpret_cast<char *>(&record),
sizeof(record));
intWritingIndex++;
}
InventoryFileSystem.close();

while(intWritingIndex < 10)
{
// Move back to the beginning of this record's position.
InventoryFileSystem.seekp(intWritingIndex * sizeof(record), ios::beg);
// Write the new record over the current record.
InventoryFileSystem.write(reinterpret_cast<char *>(&record),
sizeof(record));
intWritingIndex++;
}
InventoryFileSystem.close();