I am trying to use sample.in.txt as a test input in Xcode C++. Thus, I go to edit schema and add arguments like this.
However, when I run the project, it is still getting the input from the user and do nothing about the input file I typed on the arguments. I print the argv, then it all prints correctly.
This is my main function
int main(int argc, char** argv) {
int T;
cin >> T;
for(int i = 0; i < T; i++){
int size, shift;
cin >> size >> shift;
Array test(size);
for(int j = 0; j < size; j++){
int x;
cin >> x;
test.add(j, x);
}
test.shift(shift);
}
return 0;
}
<is a terminal thing. You can set Xcode to use a terminal, but not once did I get it to work. It's actually locked up right now, so I don't recommend that. The arguments that you're setting are literally the arguments to the program (yourargv) and not a shell re-direct. Being a full fledged IDE, Xcode expects you to be testing by writing test suites and not hitting run but hitting test. My recommendation would be to move away from Xcode, or at the least just use the terminal to compile and do the redirects yourself.