I am having problems reading in from a file in my project. I have a text file from which I need to read in data for creating some objects. I do not know how much data is in the file but I know the format is 6 lines of string, string, float, float, int, int. Everything works fine if I only have one entry in the text file but my program dies if there are any more. What can I do?
while(dataFile.hasNextLine() && numPlayers < 10)
{
good = true;
Player temp = new Player(dataFile.nextLine(), dataFile.nextLine(), dataFile.nextFloat(), dataFile.nextFloat(), dataFile.nextInt(), dataFile.nextInt());
if(temp.getMoney() > 0)
{
thePlayers[numPlayers] = temp;
numPlayers++;
}
}