I need help storing data in archives, I always get an unhandled exception when i try...

#include"Inventory.h"
#include"CustomerTransaction.h"

#include <fstream>
using namespace std;

CarInventory* car_list;

int main()
{
	
	SLL<Customer>* customer_list = new SLL<Customer>;
	car_list = new CarInventory();

	fstream file;
	file.open("Models.txt", ios::in);
	
	if (file.fail())
	{
		cout << "\nFailed to open file\n";
	}
	else
	{
		file.read((char*)& customer_list, sizeof(car_list));

		while (!file.eof())
			file.read((char*)& customer_list, sizeof(car_list));
	}

	int transaction_number = 0;
	int mainMenuOption;

	do
	{
		cout << "----------- \n"
		     << " Main Menu  \n"
			 << "----------- \n"
			 << "  (1) Make a new Transaction \n"
			 << "  (2) Display All Transactions \n"
			 << "  (3) Find All Dealer Transactions \n"
			 << "  (4) Find Transaction by ID \n"
			 << "  (5) Delete all Dealer Transactions \n"
			 << "  (6) Delete Transaction by ID \n"
			 << "  (7) Show Inventory \n"
			 << "  (8) Exit \n"
			 << " Your Option -> ";

		
		cin >> mainMenuOption;
		cin.ignore();
		
		switch(mainMenuOption)
		{
		case 1:
			{
				transaction_number += 1;
				char id[30];

				cout << "\n - Enter dealer ID : ";
				cin.getline(id, 30, '\n');
	
				MakeNewTransaction(id, transaction_number, customer_list);
			}
			break;

		case 2:
			{
				if (customer_list->Size() > 0)
				{
					Customer* temp;

					for(int i = 0; i < customer_list->Size(); i++)
					{
						temp = &customer_list->GetData(i);
						temp->ShowCustomerTransactions();

						cout << "\n\n";
					}
				}
				else
					cout << "\n\n * * * No Transactions registered at the time. \n\n";
			}
			break;

		case 3:
			{
				char id[30];

				cout << " - Enter Dealer ID : ";
				cin.getline(id, 30, '\n');

				SLL<int>* foundList = SearchCustomerTransactions(id, customer_list);

				if(foundList->Size() != 0)
				{
					Customer* temp;

					for(int i = 0;i < foundList->Size();i++)
					{
						temp = &customer_list->GetData(foundList->GetData(i));
						temp->ShowCustomerTransactions();
						cout<<"\n\n";
					}
				}
				else
				{
					cout << "\n\n * * * ID not found. \n\n";
				}
			}
			break;

		case 4:
			{
				int transactionNumber = 0;

				cout << " - Enter Transaction number that want to search : ";
				cin >> transactionNumber;
				cin.ignore();

				int pos = SearchTransactionID(transactionNumber,customer_list);

				if(pos != -1)
				{
					Customer* temp;
					temp = &customer_list->GetData(pos);
					cout << "\n\n";
					temp->ShowCustomerTransactions();
					cout << "\n\n";
				}
				else
				{
					cout << "\n\n * * * Transaction Not Found. \n\n";
				}
			}
			break;

		case 5:			
			{
				char id[30];

				cout<<" - Enter Dealer ID to delete : ";
				cin.getline(id, 30, '\n');

				SLL<int>* foundList = SearchCustomerTransactions(id, customer_list);

				if (foundList->Size() == 0)
				{
					cout << "\n\n * * * Transaction Not Found. \n\n";
				}
				else
				{
					for(int i = (foundList->Size()-1); i >= 0; i--)
					{
						customer_list->RemoveAt(foundList->GetData(i));	
					}

					cout << "\n\n * * * All Transactions for the Customer with dealer ID #" << id << " are Deleted. \n\n";
				}
			}
			break;

		case 6:
			{
				int transactionNumber = 0;

				cout << " - Enter Transaction number that want to Delete : ";
				cin >> transactionNumber;

				int pos = SearchTransactionID(transactionNumber, customer_list);

				if(pos != -1)
				{
					customer_list->RemoveAt(pos);
					cout << "\n\n * * * Transaction #" << transactionNumber << " Deleted. \n\n";
				}
				else
				{
					cout << "\n\n * * * Transaction # " << transactionNumber << " Not found. \n\n";
				}
			}
			break;

		case 7:
			{
				cout << "\n\n* * * STOCK" << endl;

				cout << "    -------------------------------------------------------------- " << endl
					 << "      #  MODEL                 PRICE                   QUANTITY    " << endl
					 << "    -------------------------------------------------------------- " << endl;

				car_list->ShowCarList();

				cout << "    -------------------------------------------------------------- \n\n";
			}
			break;

		case 8:
			file.clear();
			file.open("Models.txt", ios::out);

			if (!file.fail())
			{
				for (int i = 0; i < customer_list->Size(); i++)
				{
					file.write((char*)& customer_list->GetData(i), sizeof(Customer));
				}

				file.close();

				cout << "\n\nGoodbye . . .\n\n";
				exit(0);
			}
			else
				cout << "\n\nERROR: The archive couldn't be opened\n\n";
				
			break;
		}

		system("PAUSE"); // Pause Console
		system("CLS");   // Clean Console

	} while (mainMenuOption != 8);

	return 0;
}

Can anyone at least tell me or give me a hint on how to store data in archives linked list ???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.