View Single Post

   
  #2 (permalink)  
Old 02-20-2008, 09:48 PM
Rhonda Moffat
 
Posts: n/a
Default Re: slackware linux programming question

George <romans5_8@earthlink.net> trolled:

> Does anyone know how to capture the normal terminal output of a program
> called from a 'C' program system() call?


> I want to get the output of pstree from within my program.


> example: returnval = system("pstree");


> How can I capture the output of pstree that would normally show up in
> the terminal window?


Try returnval = system("pstree > psoutput");

The tree should be captured to the file psoutput.

See how that works.

cordially, as always,

rm
Reply With Quote