Loading data into a vector from text-file
Hi
I use the following piece of code to load a bunch of doubles into my vector:
Code:
#include <iostream>
#include <fstream>
#include <vector>
...
std::vector<double> velX;
double velTemp;
std::ifstream vX("vX.txt");
if(vX.is_open())
{
while(!vX.eof())
{
getline(vX, velTemp);
velX.push_back(velTemp);
}
vX.close();
}
else
{
cout << "Unable to open file." << endl;
}
However, my compiler says that getline is "an undeclared identifier". Isn't that what iostream is supposed to contain?
Best,
Niels.