Advertisement
Guest User

czytaj_plik

a guest
Jan 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. void Evolution::read_population_file()
  2. {
  3.     ifstream file;
  4.     file.open(pathIN, ios::in);
  5.  
  6.     if (file.good())
  7.     {
  8.         myList<int> m1;
  9.         string line;
  10.         while (getline(file, line))
  11.         {
  12.             istringstream strstrm(line);
  13.             int number;
  14.             m1.clean();
  15.             while (strstrm >> number)
  16.             {
  17.                 m1.Add(number);
  18.             }
  19.             population.Add(m1);
  20.         }
  21.         file.close();
  22.     }
  23.     else
  24.     {
  25.         cerr << "file not good\n";
  26.         throw runtime_error("File not good.");
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement