1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

making a command interpreter

Discussion in 'C' started by binary_boy, Sep 8, 2010.

  1. binary_boy

    binary_boy New Member

    Sep 8, 2010
    Likes Received:
    Trophy Points:
    i am making a command line interpreter for an os course. the preoblem statement says that i have to log the output of every command i type in this interpreter along with the usual display in the stdout.

    how do i do this?
    i have used dup2 to redirect the output to the log file, but then i cannot get the output on the screen.

    also i dont want to execute the command twice so that i can output to the stdout once and next time to the file. this is because outputs of some commands(eg. ps) do not remain same..

    PLZ help as quickly as possible..

Share This Page