C - pstree equivalent -


in bash there pstree command 'draws' tree of processes. wondering similar function in c programming language?

a simple example appreciated.

there no such 'function' in c. can program creates alike, using execl()/system() calls ps, or reading /proc file system (on linux).

from there, can children list of every process, , each process of list children etc.. starting process 1 init.

otherwise,

int main() {     system('pstree');     return 0; } 

would work :-)

if want reimplement it, you'd better follow carl norum's advice use source, luke!


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -