ok, так что это первый раз, когда я кодировал C ++ в Xcode (я используется для OBJC), и я ' Теперь теперь начал курс программирования в моем колледже.
Я пытаюсь открыть файл (либо жесткий код, либо с пользовательского ввода в консоли) и неважно, что я пытаюсь, он говорит, что файл не откроется (через Проверка ошибок)
Я предполагаю, что это потому, что файл test.txt, который у меня нет в предполагаемом корневом каталоге, поэтому, если это так, каковы корневой каталог?
Вот мой код:
//include files
#include <iostream>
#include <stdio.h>
#include <fstream>
using namespace std;
//Global Variables
short inputPicture[512][512];
short outputPicture[512][512];
//Function Prototypes
void getInput(char* in, char* out);
void initializeArray(ifstream* input);
//Main
int main(){
//local variables
char inputFile[32];
char outputFile[32];
ifstream input;
ofstream output;
getInput(inputFile, outputFile);
cout << inputFile << endl;//test what was sent back from the function
input.open(inputFile, ifstream::in);
if (!input.is_open()){//check to see if the file exists
cout << "File not found!\n";
return 1;//if not found, end program
}
initializeArray(&input);
return 0;
}//end Main
//Gets initial input from user
void getInput(char* in, char* out){
cout << "Please designate input file: ";
cin >> in;
cout << "\nPlease designate an output file: ";
cin >> out;
}//end getInput
//Sets the global array to the information on the input file
void initializeArray(ifstream* input){
}//end initializeArray
Пожалуйста, дайте мне знать, если есть что-то еще, что я делаю, я уверен, что это всегда большая возможность :)