I wanted to write a c code to implement
ls | wc
say ls and wc is in /bin.
I know how to redirect a file eg ls > list.txt.
I wanted to know if ls | wc works with the same logic as redirection? If yes, please give me the code.
I also heard that we can use the pipe().
Please implement ls | wc using pipe() in C.