Why can't I input the integers from a file?
- by Anthony Glyadchenko
I'm trying to get this C++ code to input a series of numbers from a text file:
int x = 0;
cin >> x;
ifstream iffer;
int numbers[12];
iffer.open("input.txt");
for (int i = 0; i < 12; i++){
iffer >> numbers[i];
}
This doesn't seem to work on the Mac.
Every cell will equal to 0 regardless of the values in the text file. In other words, the ifstream isn't assigning the numbers.
How can I make this work? Is it a Mac issue and if so, how can I get it to work?
Thanks!
Anthony Glyadchenko