I am trying to write a getline function that will take in a string of words from an open stream...I have looked on different websites and tried what it says to do, but I am getting tons of weird errors. I need the getline to take in all of the words in the "contents" section of my file. This is what I have tried, but I am getting errors with this.
// Fill a single Tweet from a stream (open file)
// Returns true if able to read a tweet; false if end of file is encountered
// Assumes that each line in the file is correct (no partial tweets)
bool Tweet::FillTweet(ifstream &Din)
{
string tmp;
bool Success = false;
Din >> tmp;
if (!Din.eof())
{
Success = true;
date = tmp;
Din >> hashtag >> getline(Din,contents);
}
else
cout << "I don't want to read your tweet anyway. " << endl;