   End of File?
  Hello, I've got this in my code std::string sFile;char ch; // Create Char to Load Data into Stringwhile (!infile.eof())  // Load all the file into a string{   infile.get(ch);   sFile += ch; //Add all data to the string} but for some reason, it always adds another of whatever was the last characterdoes anyone know why it does this? because as soon as the end of the file hits...its suppose to not execute the code right?? so whats going on?    <SPAN CLASS=editedby>[edited by - kag1 on May 29, 2004 1:13:31 PM]</SPAN>[/source][edited by - kag1 on May 29, 2004 1:14:23 PM]
infile.get(ch);while (!infile.eof()) {  sFile += ch;  infile.get(ch);}Couldn''t tell why, but this should at least solve it.;  Your''s was checking the char before the one you''re currently processing, which means it doesn''t see the end of file until it tacks another char on there. ;std::string sFile;char ch; // Create Char to Load Data into Stringwhile (infile.get(ch))  // Load all the file into a string{   sFile += ch; //Add all data to the string} I *think* get works the same way as the << operator and it''ll return false if its an EOF/other error ;  Wouldn''t it also return false at white space? 