How would one read the following in C?
./a.out < /bin/ls
I would like to read the output of /bin/ls command in my program. But first I need to figure out how to get that output. Is there a way to do this?
/bin/ls
You could use the piping feature, that:
connects the STDOUT (standard output) file descriptor of the first process to the STDIN (standard input) of the second.
Example:
/bin/ls | ./a.out