Piping output between processes. C.
Hello everyone. I have a problem.
I have to write a peace of code in C that will simulate a simple shell and in that shell only commands that are listed in specification file are allowed. However, that is not a problem, because I got it working already for single command entries. What I'm struggling with is geting output piped from one command to another like: # ls -l | grep stuff given that both ls and grep are permitted. Any idea how to approach it? I use fork() and execvp() to execute commands. Many thanks in advance. |
I am so sorry.
I should have searched this forum before posting my question. This problem can easily be solved by using popen() like it was suggested in thread below. Sort of: Code:
/***************************************************************************** |
All times are GMT -5. The time now is 09:25 PM. |