0

I know there's lots of related questions about this, but I can't seem to find the answer. I'm trying to read in a .csv file (though the same problems happen with .txt files), but the program never actually is able to open it. I know that it is in the correct working directory because it's with the other files in the program that are executing. Basically, the program keeps prompting me to give the name of the file for input, which says to me that there is a problem reading in the ifstream, so it's never getting out of the while loop. Any thoughts?

string fileName;
ifstream sheetStream;

do {
    cin.clear();
    cout << "Enter spreadsheet file name: ";
    cin >> fileName;
    cout << fileName << endl;
    sheetStream.open(fileName, ios::in);
} while (!sheetStream); 
tgordon18
  • 1,562
  • 1
  • 19
  • 31

0 Answers0