942,967 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 66
  • C RSS
Sep 8th, 2010
0

making a command interpreter

Expand Post »
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..
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
binary_boy is offline Offline
3 posts
since Sep 2010
Sep 8th, 2010
0
Re: making a command interpreter
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.
Administrator
Reputation Points: 6442
Solved Threads: 1391
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Sep 8th, 2010
0
Re: making a command interpreter
Click to Expand / Collapse  Quote originally posted by Narue ...
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
binary_boy is offline Offline
3 posts
since Sep 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: program in c to convert a integer into a binary number & vice versa
Next Thread in C Forum Timeline: plz help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC