title: How to run test inputs on C++ program in Xcode?
body: <p>I am fairly new to programming so bear with me if a lot of the things I'm asking sound trivial. I'm learning C++ and experimenting with using Sublime+OSX terminal vs Xcode (IDE) to compile and run my programs. I know how to use the UNIX shell to compile and run the executable, taking an input file. However, I don't know how to do this in Xcode, which I would like to do in order to use the debugger. Is there a straight forward way to do this in Xcode? (I would also prefer to not have to open up my test.txt file and edit it every time I want to change my test input - is there some way for me to edit directly in Xcode?)</p>
  
  <p>Thanks a lot!</p>
  
  <p>Edit:
  To be more clear about what I'm looking for - I'm writing a program that will take some lines of input as information/commands and use them to do a matrix operation. Let's say I want it to add two 2x2 identity matrices. The input lines would look like</p>
  
  <pre><code>add
  2
  2 2
  1 0 0 1
  2 2
  1 0 0 1
  </code></pre>
  
  <p>Now I am using Xcode to develop and have written my source code entirely here. I know how to save a file to the same directory as my main.cpp, or even to the same folder as the .exe (it's going to the debug folder since I'm using Xcode in debug mode vs release mode). So I can edit and build/run my program, I can edit the text file I'm going to use as input, but I don't know how to actually send the input text file information to my executable. I open up the scheme editor and I can see that I can either specify arguments passed on launch or set environmental variables. I am not trying to set arguments (my main method is main(void)). Instead, I am using std::cin in my code and want cin to grab information from the text file (or better yet, simply type in the lines of input into xcode somewhere before I run the program). I had found this link <a href="http://jtdaugh.github.io/xcode-umich/" rel="nofollow">http://jtdaugh.github.io/xcode-umich/</a> before asking on stackoverflow and I feel like the section on input redirection is what I'm looking for, but I tried it out and it didn't work for me/I didn't understand the instructions.</p>