0

re updated my question and found this fix to exit a while loop when using an overloading input stream, is this ok to use?? i don't want to use it just because it works.

int main()
{
    cout << "start" << endl;

    Vector<WindLogType> windlog;

    fstream file("MetData.csv");

    while (!file.eof())
    {
        WindLogType temp;

        file >> temp;

        windlog.insert(temp);

        if (file.peek() != EOF) {
            break;
        }
    }

    }

    cout << "end" << endl;
}
Getwrong
  • 177
  • 1
  • 2
  • 13

1 Answers1

0

Use break; when you "hit" the exit-criteria

Alexander Falk
  • 499
  • 8
  • 21