ifstream ffq("./conf/AP_Freqs.txt");
string Line;
getline(ffq,Line); // Waste the first line, it's a header
while (getline(ffq,Line))
{
stringstream iss(Line);
FREQUENCIES temp; //Structure FREQUENCIES (has 1 string and 6 floats)
iss >> temp.airport; //string
iss >> temp.ground; //float
iss >> temp.tower; //float
iss >> temp.arrival; //float
iss >> temp.departure; //float
iss >> temp.clearance; //float
iss >> temp.apron; //float
vFreqs.push_back(temp); //This is a vector
cout << temp.airport << "\t" << std::fixed << std::setprecision(1)
<< temp.ground << "\t" << temp.tower << "\t" << temp.arrival << "\t"
<< temp.departure << "\t" << temp.clearance << "\t" << temp.apron
<< endl;
}
Unfortunately, I am never able to enter the while loop above, as ffq apparently has a badbit set on the first line. If I use this following code instead (checking specifically for an eof()), then I get an infinate loop where none of the values are correct:
Did you already check if you actually got to open the file? You might be looking for it in the wrong directory or something (e.g. your working directory may be different from what you expect it to be).
I just tried changing the path of the file to the root of the .exe and .dll and moving the file to that location. There was no difference. I have other files that I am working with in the ./conf/ directory and these are read without problem (but they aren't in the same format).