Taking a text file and assigning the individual lines to a class

I am trying to take a text file with names and addresses and place them into already created classes such as Name and Address( Street, city, state, zip code). Much help needed!
Well I'd start with using fstream to start reading the file, then I'd have it break once it's read a name/address, save it, then keep going.
This is what I have

#include <iostream>
#include <fstream> // for file I/O
#include <cstdlib> // for exit()
#include <string>

using namespace std;

Venue* Create_Venue()
{
char name_[Venue::MAX_VENUE_NAME+1];
Address address_;
cin >> name_;
return new Venue(name_, address_);
}

int main()
{
using namespace std;
string filename;
ifstream infile;
char input_line[1000];

cout << "This is a Venvue Sort Program\n";
cout << "Name for input file: ";
cin >> filename;


cout << /*num_venues <<*/ "\n venues read from file" << endl;

cout << "Venues before sort: " << endl;

infile.open(filename.c_str() );

if (!infile.is_open())
{
cout << "Failed to open file\n";
cin.get(); // Keep window open.
cin.get();
exit (EXIT_FAILURE);
}

// Input file is open
while (infile.good())
{
infile.getline(input_line, 1000);
cout << input_line << endl;
}

if (infile.eof())
{
cout << endl << "End of file \n";
}
else
{
cout << endl << "Error reading file\n";
}

infile.close();

cout << "Normal termination\n";
cin.get(); // Keep window open.
cin.get();
return 0;
}




and the text file is

test.txt

Carol Morsani Hall
1010 North W.C. MacInnes Place
Tampa
FL
33602
Tampa Theatre
711 N Franklin Street
Tampa
FL
33602
1-800-ASK_GARY Amphitheatre
4802 N US Highway 301
Tampa
FL
33610
St. Pete Times Forum
401 Channelside Dr
Tampa
FL
33602
The Tampa Improv
1600 E 8th Ave
Tampa
FL
33605
Skipper's Smokehouse
910 Skipper Road
Tampa
FL
33613
How do I create an array of char to store them?
I'd use a vector of char personally... and then do something like this:

vector<char> v;

....

while (infile.good())
{
infile.getline(input_line, 1000);
v.push_back(input_line);
}

Are you allowed to use vectors?
vector<char> can only store that many. I look at his input file I feel vector<string> should be a better data structure instead.

Of even better, vector<MyClass> where he define MyClass to be a C++ class that contain addresses, names etc.
Topic archived. No new replies allowed.