Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

According to this http://www.cplusplus.com/reference/clibrary/csignal/signal.html

SIGINT is generally used/cause by the user. How do i cause a SIGINT in c++? i seen an example using kill(pid, SIGINT); but i rather cause it another way. Also i am using windows.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
280 views
Welcome To Ask or Share your Answers For Others

1 Answer

C89 and C99 define raise() in signal.h:

#include <signal.h>

int raise(int sig);

This function sends a signal to the calling process, and is equivalent to

kill(getpid(), sig);

If the platform supports threads, then the call is equivalent to

pthread_kill(pthread_self(), sig);

The return value is 0 on success, nonzero otherwise.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...