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..

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by binary_boy
0

Assuming you need to do it all manually, how about redirecting output to a temporary file? Then you can echo the temporary file to the screen as well as append it to your log file.

0

Assuming you need to do it all manually, how about redirecting output to a temporary file? Then you can echo the temporary file to the screen as well as append it to your log file.

yes..thats a good idea...thankss a lot...if you get anything better plz let me know.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.