LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Converting bash command to C code (https://www.linuxquestions.org/questions/programming-9/converting-bash-command-to-c-code-65187/)

Linh 06-12-2003 11:02 AM

Converting bash command to C code
 
What is the equivalent built in function call in C to kill a process and to shutdown an ethernet card?

Bash code
1) killall smbd > /dev/null
2) ifconfig eth0 down > /dev/null
=========================

C code ?

1)
2)

rmartine 06-12-2003 12:33 PM

man system

man execvp

I think one of those should help

Hko 06-12-2003 03:21 PM

And/or

man 2 kill

jperensky 06-13-2003 10:39 AM

or...
 
If there is a specific C funtion that works then go with that but the less desireable, efficient or professional way would be to use a system command included in unistd.h system("..."); You can use any command that you would issue from the bash prompt just through your application.

:)


All times are GMT -5. The time now is 10:07 PM.