An Array of Structs

I need to Prompt the user to input the name of the data file. Input the data from the file into an array of structs. Use Selection Sort to sort the data by player number. Print a labeled listing of the sorted data to the screen. I can do the selection sort i just cant get my array to pop up and show itself. It says the file was opened but nothing was there. Help would greatly be appreciated.:)

#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;

struct footballPlayers
{
int number;
string first;
string last;
char position;
char year;
double height;
int weight;

};

const int MAX_PLAYERS = 25;

void getData (ifstream& inFile, footballPlayers list [], int listSize);
void printList ( footballPlayers list [], int listSize);

void printOne (footballPlayers one);
footballPlayers getOne (ifstream& inFile);
footballPlayers addOne ();







int main ()
{
cout<<"Driver Name: Chad Cundiff"<<endl;
cout<<"Navigator Name: Chad Cundiff"<<endl;
cout<<"Date: November 9, 2010"<<endl;
cout<<"Lab CRN: 10940"<<endl;
cout<<"This Program works with an array of structs."<<endl;
cout<<endl<<endl;

footballPlayers list [MAX_PLAYERS];
int roster;

char choice;

string filename; // name of the input file
ifstream inFile; //input file stream variable

cout << "Enter the name of the input file: " ;
cin >> filename;

inFile.open(filename.c_str () );
if (!inFile)
{
cout << "bummer file name \n\n";
system ("pause");
return 1;
}

cout << filename << " was opened" << endl<<endl;

getData (inFile, list, roster);
printList ( list, roster);







system ("pause");
return 0;
}



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

item = getOne (inFile);

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

item = getOne (inFile);
}
inFile.close () ;
}

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

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

///////////////////////////////
footballPlayers getOne (ifstream& dataIn)
{
footballPlayers one;

dataIn >> one.first >> one.last >> one.number
>> one.position >> one.year >>;


return 1;
}

The declaration of getOne() says it returns a footballPlayers struct, but the code returns 1 (which isn't
a footballPlayers struct instance). Not sure how that would even compile.
its not running at all but no errors are coming up, it says there is a linkage error i really just need to get the code right so my array will print, which i am not sure of.
Topic archived. No new replies allowed.