I am trying to read and store data from a file from my computer using ifstream, but after building and compiling, my command line interface does not display the output that I am expecting. My code looks like:
#include <iostream>
using namespace std;
int main ()
{
int num1;
ifstream file_In;
file_In.open("YES");
file_In >> num1;
cout << num1 << endl;
file_In.close();
return 0;
}
I have a text file named "YES" on my desktop and it simply contains the text: 10 20 5 5 5 7
and I am expecting to see the number 10 displayed on my command line interface but instead, I get a 0.