开发者

Kill command in c-programming [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Unable to 开发者_开发问答understand the “Kill” program of linux

Hi All, Can anyone explain me how this program works. Please explain what each line do.

#include<stdio.h>
#include<sys/types.h>
#include<signal.h>

int main(int argc, char **argv)
{
    if (argc < 2)
    {
        printf("usage: ./kill PID");
        return -1;
    }

    kill(atoi(argv[1]), SIGKILL);

    return 0;

}


The line kill(atoi(argv[1]), SIGKILL); sends a SIGKILL signal to the process with the specified ID; this should cause it to terminate. The atoi(argv[1]) part converts the string from the command-line parameters into an integer.

For the rest, I recommend picking up a beginner's guide to C.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜