I'm writing a program and I need to set the program up to get input from a text file and save the output in a text file. I'm using Xcode and I'm on a mac. I know I need to enter some redirection commands in the console but I'm not exactly sure how to do it. For example text files feel free to use input.txt and output.txt.
Thank you for the help.
On the terminal (command line) you can do
command < input.txt > output.txt
or
cat input.txt | command > output.txt
Edit:
Ok, thanks a lot. Just curious, when I type that in the terminal,
how does it know to go to Xcode?
The only connection between running the command on the terminal and Xcode is that you build the program in Xcode. That produces an executable that can be run either by Xcode or from the shell (terminal). Running the program on the terminal has absolutely no effect on Xcode.
There might well be a way to redirect I/O from within Xcode (perhaps that is what you originally wanted) but I am unaware of it (don't use Xcode).