title: My ifstream doesn't seem to be working
body: <p>This is a main file that I am using to test methods before I implement them.  I am trying to get the list of all files in a directory, write them to a txt file (It works fine until here), then read the file names from that text file.</p>
  
  <pre><code>using namespace std;
  
  string sysCall = "", location = "~/Documents/filenames.txt";
  string temp = "";
  sysCall = "ls / &gt; "+location;
  system(sysCall.c_str());
  
  ifstream allfiles(location.c_str());
  allfiles.good();
  getline(allfiles, temp);
  cout&lt;&lt;temp&lt;&lt;endl;  //At this point, the value of temp is equal to ""
  
  return -1;
  </code></pre>
  
  <p>After the program runs, no text has been outputted.  From what I've read in other peoples' questions, this should work (but obviously doesn't).  What am I doing wrong here?</p>
  
  <p>EDIT: allfiles.good() returns false, but I don't understand why it would return that...</p>