0

I am trying to write a code that will open a .csv file. However, the actual file does not open. Instead it, jumps straight to the else statement at the end. I have no clue why because this should work. This is including the fstream library.

enter image description here

ifstream ycratel; //create the stream object

ycratel.open("YC Rate Levels.csv");

if (ycratel.is_open())
{
    while (ycratel.good())
    {
        //random stuff here
    }

    ycratel.close();

}

else cout << "Unable to open file.";
πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
user5619709
  • 53
  • 2
  • 11

1 Answers1

3

This has nothing to do with the file format at all. Just that source code and resource csv are in different folders as clearly evident from the Solution Explorer.

ycratel.open("./Resource Files/YC Rate Levels.csv");

should do the job

sjsam
  • 21,411
  • 5
  • 55
  • 102