Please, I know this is a simple question. I'm copying this code out of my text book, almost ver-mother#&$(ing-batm And it mother#&$(ing refueses, REFUSES to open the mother#&$(ing file and write to the mother#&$(ing array. WTF - Sorry for the language, but this is so stupid and silly and I have NO mother#&$(ing clue why this isn't working. I've spent more time than I want to admit publicly on this problem PLEASE HELP!
What's happening is ifstream is doing God-knows-what, and then it creates an array and that array if filled with what ever crap was in that memory location. There is no communication betwixt ifstream and the array. Please, please, please ket me know what I am doing wrong. I'm newish to programming, but this is right out of my book.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
const int len = 8;
int numsRead[len];
int count = 0;
ifstream inputFile;
inputFile.open("eight.txt");
while(count < len && inputFile >> numsRead[len])
count++;
inputFile.close();
cout << numsRead[1] << " " << endl;
return 0;
}