I'm writing a program that accepts a file and inputs each line from a txt file into a vector. Is it correct to use:
Code:
class filereader
{
public:
filereader(string filename);
private:
}
filereader::filereader(string filename)
{
vector<string> v;
ifstream File(filename.c_str());
cin.getline(filename.c_str());
v.push_back(filename);
while(cin.good())
{
cin.getline(filename.c_str());
v.push_back(filename);
}
}
The class is not what I'm using, it's just to complement the function. What I need help with is the function filereader(string filename).
I'm sort of confused. I would appreciate any help!