Array of Structs from .txt file
<p>have a project where I'm supposed to ask the user to input a file name and then take that file and make an array of structs. I'm completely lost! Here is what i have so far</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
#include &lt;iomanip&gt;

using namespace std;

string filename;
ifstream inFile;

struct ftballPlayer
{
    int NO;
    string first;
    string last;
    char POS;
    char clas;
    int height;
    char ds;
    int iheight;
    string hometown;
};

int counter=0;
const int MAX_PLAYER=50;
void printList(const ftballPlayer list[],  int listSize);
void printOne ( ftballPlayer two);
void getData(ifstream&amp; inFile, ftballPlayer list[], int&amp; listSize);

int main ()
{
    ftballPlayer list[MAX_PLAYER] ;
    cout &lt;&lt; "Enter the name of the input file:  " ;
    cin &gt;&gt; filename;

    inFile.open(filename.c_str ()  );

    if (!inFile)
    {
        cout&lt;&lt;"Cannot Open Input File."&lt;&lt;endl;
        cout&lt;&lt; "Program Terminates!"&lt;&lt;endl;
        return 1;
    }

    inFile.ignore (200,'\n');
    getData (inFile,  list, counter);

    for ( counter = 0;counter &lt; 50;counter++)
    {
        printOne (list[ counter] ) ;
        cout  &lt;&lt;endl;
    }

    return 0;
}

void getData(ifstream&amp; inFile, ftballPlayer list[], int&amp; listSize)
{
    ftballPlayer item ;
    listSize = 0;

    inFile &gt;&gt; item.NO &gt;&gt; item.first &gt;&gt; item.last
           &gt;&gt; item.POS &gt;&gt; item.clas &gt;&gt; item.height
           &gt;&gt; item.ds &gt;&gt; item.iheight &gt;&gt; item.hometown;

    while (inFile )
    {
        list [listSize ] = item ;
        listSize++;

        inFile &gt;&gt; item.NO &gt;&gt; item.first &gt;&gt; item.last
               &gt;&gt; item.POS &gt;&gt; item.clas &gt;&gt; item.height 
               &gt;&gt; item.ds &gt;&gt; item.iheight &gt;&gt; item.hometown;
    }

    inFile.close () ;

}

void printList(const ftballPlayer list[],  int listSize)
{
    int looper;

    for ( looper = 0; looper &lt;  listSize ; looper++)
    {
        printOne ( list [looper]  );
        cout &lt;&lt; endl ;
    }
}

void printOne ( ftballPlayer one)
{  
    cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision (2);
    cout &lt;&lt; "NO " &lt;&lt; one.NO;
    cout &lt;&lt; setw(5) &lt;&lt; left &lt;&lt; "  Name: " &lt;&lt; one.first &lt;&lt; " " &lt;&lt; one.last;

    cout &lt;&lt; "  POS " &lt;&lt; one.POS &lt;&lt; setw(5);
    cout &lt;&lt; "Class "&lt;&lt;one.clas&lt;&lt;setw (5);
    cout &lt;&lt; "Height "&lt;&lt;one.height&lt;&lt;" "&lt;&lt;one.ds&lt;&lt;" "&lt;&lt;one.iheight&lt;&lt;setw(5);
    cout &lt;&lt; "Hometown " &lt;&lt; one.hometown &lt;&lt; endl;
}
</code></pre>

<p>Can someone tell me if I'm on the right track? The print out I get is not even close to the text file which is this.</p>

<blockquote>
  <p>NO NAME POS CLASS HEIGHT WEIGHT Hometown/High School/Last College<br>
  60 Josh Mann OL SO 6-4 300 Virginia Beach, Va./Ocean Lakes<br>
  64 Ricky Segers K/P FR 5-11 185 Glen Allen, Va./Henrico<br>
  70 Brandon Carr OL RS_SR 6-2 305 Chesapeake, Va./Western Branch/Fork Union Military Academy<br>
  53 Calvert Cook LB FR 6-0 250 Norfolk, Va./Booker T. Washington<br>
  51 Michael Colbert DE RS_SR 6-1 230 Fayetteville, N.C./E.E. Smith<br>
  22 T.J. Cowart CB RS_JR 5-9 190 Virginia Beach, Va./Ocean Lakes<br>
   1 Jakwail Bailey WR SO 5-11 185 Haddonfield, N.J./Paul VI<br>
  25 Andre Simmons S JR 6-0 205 Lorton, Va./South County/Vanderbilt<br>
  34 Johnel Anderson RB FR 5-8 180 Sicklerville, N.J./Paul VI  </p>
</blockquote>

<p>This is one of three that the user can input but they all have the same type of information. I've looked in my text book and have been hunting online for hours and I can't find anything about doing this when the user inputs the file instead of just starting with a file. Any help or direction would be greatly appreciated. </p>
