I have a program here that I am getting errors on and need some guidance on what I need to fix. When I run the program the compiler will not let me append or show a record.



Code:
 
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
 
void menu(void);
void writeData(void);
void readData(void);
string * split(string, char);
 
const char FileName[] = "c:/TestAddress.txt";
 
int main ()
{
	menu();
	return 0;
} //end main
 
void menu(void)
{	
	char choice = ' ';
	cout << "\nWhat Would You Like To Do With These Records: \n\n";
	cout << "Append Records (A), Show Records (S), or Exit (E)\n"; 
	 cin >> choice;
 
	while(choice == 'A' || choice == 'S');
	{
		switch(choice)
		{
			case 'a':
			case 'A':
				writeData();
				break;
			case 's':
			case 'S':
				readData();
				break;
		}
		cout << "What Else Would You Like To Do?\n";
		cout << "Append Records (A), Show Records (S), or Exit (E)\n"; 
		 cin >> choice;
	}
}//end menu
 
void writeData(void)
{
	char choice = ' ';
	string name = "";
	string street = "";
	string city = "";
	string state = "";
	string zipCode = "";
	ofstream outMyStream(FileName, ios::app);
 
	do
	{
		cout << "\nEnter The Name: ";
		getline(cin, name);
		cout << "\nEnter The Street: ";
		getline(cin, street);
		cout << "\nEnter The City: "; 
		getline(cin, city); 
		cout << "\nEnter The State: "; 
		getline(cin, state);
		cout << "\nEnter The Zip Code: "; 
		getline(cin, zipCode);
 
		outMyStream << name << "," << street << "," << city << "," << state << "," << zipCode;
 
		cout << "\nEnter another Record? (Y/N) ";
		cin >> choice;
	}
	while (choice == 'Y' || choice == 'Y' ); 
	outMyStream.close();
}//end write data
 
void readData(void)
{
	ifstream inMyStream (FileName);
	string lineBuffer;
	while (!inMyStream.eof() )
	{
		getline (inMyStream, lineBuffer, '\n');
		string *theFields = split(lineBuffer, ',');
		cout << "Name...... " << theFields[0] << endl;
		cout << "Street.... " << theFields[1] << endl;
		cout << "City...... " << theFields[2] << endl;
		cout << "State..... " << theFields[3] << endl;
		cout << "Zip code.. " << theFields[4] << endl;
	}
}//end read data
 
string * split(string theLine, char theDeliminator)
{
	//Break theline into fields and save the fields to an array.
	//Each field will occupy one element in a character array.
	//theLine is a string with fields separated with theDeliminator character.
	//Assumes the last field in the string is terminated with a newline.
	//Useage: string *theFields = split(lineBuffer, ',');
 
	//determine how many splits there will be so we can size our array
	int splitCount = 0;
	for(int i = 0; i < theLine.size(); i++)
	{
		if (theLine[i] == theDeliminator)
		{
			splitCount++;
		}
	}
	splitCount++; //add one more to the count because there is not an ending comma
	//create an array to hold the fields
	string* theFieldArray;
	theFieldArray = new string[splitCount];
	//split the string into seperate fields
	string theField = "";
	int commaCount = 0;
 
	for(int i = 0; i < theLine.size(); i++)//read each character and look for the deliminator
	{
		if(theLine[i] != theDeliminator) 
		{
			theField += theLine[i]; //build the field
		}
		else //the deliminator was hit so save to the field to the array
		{
			theFieldArray[commaCount] = theField; //save the field to the array
			theField = "";
			commaCount++;
		}
	}
	theFieldArray[commaCount] = theField; //the last field is not marked with a comma...
	return theFieldArray;
} //end split