Hi friends,
I want to implement code which can take input from some other application.
Like say for example
ls | less
Here, less is the application/utility which takes input from ls via pipe.
I want to implement the same in C.
I Did following things
- Created PIPES using pipe command
- close local input via close(0)
- use dup2(0,fd[0])
- then i'm trying to read from fd[0] abd printing on console.
When I pass like
echo "testing" | ./myapps
Nothing happens
Can anyone suggest what am i missing?
Harry