In the following function, my istringstream sets the fail bit the second time through the while loop on the line with the HERE comment. I've checked the contents of both command and ist, and they both seem to be right. Any ideas about what I'm doing wrong? Under what conditions can the HERE line fail?
int openFile(string filename)
// open file
//read in file contents
ist >> command; //HERE
//really long if-statement
getline() may be failing are getting an empty string. See what is in command just before >> fails.
I did. command contains the correct data. getline() is working as it should. I've made a semi-workaround...if ist>>command fails, I clear the fail bit and try again once. If it still fails, it throws an exception. Not exactly the way I wanted it to work. =/ It still doesn't explain why it's failing.
This is starting to happen throughout my program...ist>>anything is failing. Under what conditions does it fail?