When I read a file from the same folder, everything is fine, but when I'm trying to read the same file from another folder, the output is many zeros.
Tour baseTour;
std::ifstream file("10_50_5.txt");
while(!file.eof())
file >> baseTour;
std::cout << "Udany odczyt danych z pliku\n\n";
file.close();
std::istream& operator >> (std::istream& is, Tour& tour) {
//std::cout << "pop size: " << p.POPULATION_SIZE << " cit num: " << Tour::CITIES_NUMBER <<
Tour t;
std::vector<City> ccities;
std::vector<int> ssalesmen;
std::vector<Tour> ttours;
int number, x, y, i, j, sal = 0, index = 0;
is >> POPULATION_SIZE >> CITIES_NUMBER >> SALESMEN_NUMBER;
std::cout << POPULATION_SIZE << "\n" << CITIES_NUMBER << "\n" << SALESMEN_NUMBER << "\n";
for(j = 0; j < CITIES_NUMBER; j++) {
is >> number >> x >> y;
std::cout << number << " " << x << " " << y << "\n";
ccities.push_back(City(number, x, y));
}
tour.setTour(ccities);
return is;
}
I have tried with "../data/10_50_5.txt" and "/home/folder/data/10_50_5.txt".