Re: How to use a shell command in an application?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Yasmine Habib wrote:

How can i use a shell command inside a program or application? in
other words, i am writing a small scheduler that needs to get the
current cpu usage/utliization of a processor at a certain time. using
"top", "free", "vmstat" provide me with required information but just
as a display when used as a shell command. i need the code to be
written inside my scheduler.


You can try it out with the system( ) call. This will give you the flexibility to run any command that u can run in the shell.

sandeep

Thank you

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/





-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux