If I have two command line arguments to my program like soc - How do you accept a command line argument via redirection
./program hey.txt hello
but I wanted to accept the first argument like this
./program hello < hey.txt
How would I be able to do that?
The '<' and 'hey.txt' won't be seen by the program on Unix; the shell will interpret them as 'redirect standard input so it comes from the file 'hey.txt''. It is not at all clear, therefore, what you are after. At one level, there's nothing to do: if given one argument, the program can read from standard input. If you're trying to do something else, you'll need to explain it. – 2014-09-27 01:29:17