I am currently making a program that reads a CSV file with information about films from 2015, and then makes film objects based on that information, and then adds those films to a binary search tree.
The problem I am facing is it will only read three lines of the CSV file. Below is the method I am using to read the file.
void FilmDatabase::createDatabase (void)
{
      string InputFile = "films2015.csv";
      string inputString = "";
      ifstream inFile(InputFile.c_str());
      int rank= 0;
      string filmTitle = "";
      string studio = "";
      double totalGross = 0;
      int totalTheaters = 0;
      double openingGross = 0;
      int openingTheaters = 0;
      string openingDate = "";
      string token = "";
      if(!inFile)
      {
         cout << "File not found" << endl;
      }
      else
      {
         while(!inFile.eof())
         {
            getline(inFile, inputString);
            istringstream iss1(inputString);
            getline(iss1, token, ',');            
            rank = atoi(token.c_str());
            getline(iss1, token, ',');            
            filmTitle = token;
            getline(iss1, token, ',');            
            studio = token;
            getline(iss1, token, ',');            
            totalGross = stod(token);
            getline(iss1, token, ',');            
            totalTheaters = atoi(token.c_str());
            getline(iss1, token, ',');            
            openingGross = stod(token);
            getline(iss1, token, ',');            
            openingTheaters = atoi(token.c_str());
            getline(iss1, token, ',');
            openingDate = token;
            Film film(rank, filmTitle, studio, totalGross, totalTheaters, openingGross, openingTheaters, openingDate);
            film.printFilm();
            filmDatabaseBST.add(film);
         }
         
         inFile.close();
      }    
}
The data for this program looks something like this
1,Star Wars: The Force Awakens,BV,916257964.00,4134,247966675.00,4134,12/18/15 2,Jurassic World,Uni.,652270625.00,4291,208806270.00,4274,6/12/15 3,Avengers: Age of Ultron,BV,459005868.00,4276,191271109.00,4276,5/1/15 4,Inside Out,BV,356461711.00,4158,90440272.00,3946,6/19/15 5,Furious 7,Uni.,353007020.00,4022,147187040.00,4004,4/3/15 6,Minions,Uni.,336045770.00,4311,115718405.00,4301,7/10/15 7,The Hunger Games: Mockingjay - Part 2,LGF,281392486.00,4175,102665981.00,4175,11/20/15
 
    