So I am trying to read from a file named input_file till it reaches the end. I've tried using while (!input_file.eof()) but it goes on for an infinite loop. I looked around on the forum and tried using while (getline(input_file, line)) but that just returns an empty line. I'm not using both getline() and the >> operator like other questions were.
How do I get around this? Here's my code: 
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
// Main program
void CalfFlac(ifstream& input_file) {
  string text;
  string line;
  while (getline(input_file, line)) {
    text += line;
  }
  cout << text << endl;
}
int main() {
  ifstream input_file;
  input_file.open("calfflac.in");
  CalfFlac(input_file);
}
input_file contains a single line Confucius say: Madam, I'm Adam. followed by a carriage return.
Thanks for the help!
PS: I'd prefer if the solution remained simple, as this appears to be a pretty simple problem.
 
     
    