I am trying to write a command-line application with XCode.
My application takes input from stdin. The way I normally use it is to use redirection to specify the input file. For example:
In XCode, this is presumably specified by creating an executable and editing its info, via Project -> Edit Active Executable "...".
But the dialog doesn't explain how to specify where input comes from. Changing the arguments to include "< input.txt" doesn't work, I guess because "<" is a symbol known to the Terminal, and XCode probably bypasses the Terminal. Changing the option to "Use Pipe for standard input/output" seems to have no effect - perhaps there's a way to specify a pipe, but the dialog won't let me. Searching the XCode User's Guide didn't explain it either - it mentions the "Use Pipe" option, but doesn't describe how it works.
How can I get standard input from a file?
My application takes input from stdin. The way I normally use it is to use redirection to specify the input file. For example:
Code:
program < input.txt
In XCode, this is presumably specified by creating an executable and editing its info, via Project -> Edit Active Executable "...".
But the dialog doesn't explain how to specify where input comes from. Changing the arguments to include "< input.txt" doesn't work, I guess because "<" is a symbol known to the Terminal, and XCode probably bypasses the Terminal. Changing the option to "Use Pipe for standard input/output" seems to have no effect - perhaps there's a way to specify a pipe, but the dialog won't let me. Searching the XCode User's Guide didn't explain it either - it mentions the "Use Pipe" option, but doesn't describe how it works.
How can I get standard input from a file?