For some reason, Xcode will not take input from a file, while Visual C++ will. When I run this program in xcode, the variables numberRows and numberCols stay 0 (they are initialized to 0 in the main function). When I run it in Visual C++ they become 30 and 30 (the top line of maze.txt is "30 30" without the quotes). Any ideas why this is happening?
void readIn(int &numberRows, int &numberCols, char maze[][100]){
ifstream inData;
inData.open("maze.txt");
if (!inData.is_open()) {
cout << "Could not open file. Aborting...";
return;
}
inData >> numberRows >> numberCols;
cout << numberRows << numberCols;
inData.close();
return;
}