making a command interpreter

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

  1. binary_boy

    binary_boy New Member

    Joined:
    Sep 8, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice