0

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?

0

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.