I am trying to read about 2 lines from a file of text into a std::string in c plus plus. I have looked through several answers and found none that work on my device. Can anyone tell me what I am doing wrong? The method is currently returning a null string, and doesn't correctly open the file or read it at all.
std::string readFile(std::string filename) {
  std::ifstream infile;
  infile.open(filename);
  std::string output;
  if (infile.is_open()) {
    while(infile.good()) {
      infile >> output;
    }
  }
  infile.close();
  return output;
}
 
     
    