首页 > 其他分享 >dms

dms

时间:2022-11-09 22:24:27浏览次数:43  
标签:include signal SIGINT handler sig signum dms

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
using namespace std;
void sig_handler(int signum)
{
    if(0 > signum)
    {
    fprintf(stderr,"sig_handler param err. [%d]\n",signum);
    return;
    }
    if(SIGINT == signum)
    {
        printf("Received signal [%s]\n",SIGINTsignum?"SIGINT":"Other");
    }
    if(SIGQUIT == signum)
    {
        printf("Received signal [%s]\n",SIGQUITsignum?"SIGQUIT":"Other");
    }
 
    return;
}
 
int main(int argc,char **argv)
{
    printf("Wait for the signal to arrive.\n ");
 
    /*登记信息*/
    signal(SIGINT,sig_handler);
    signal(SIGQUIT,sig_handler);
 
    pause();
    pause();
 
    signal(SIGINT,SIG_IGN);
    return 0;
}

标签:include,signal,SIGINT,handler,sig,signum,dms
From: https://www.cnblogs.com/yu15141310373/p/16875393.html

相关文章

  • C# AVEVA PDMS 修改快捷键
    修改快捷键和提示文件 提取菜单栏按钮publicstaticList<ButtonToolImpl>GetButtonImpls(thisMenuToolImplmtl){List<ButtonT......
  • PDMS-螺栓计算
    PDMS-螺栓计算[email protected],PDMS,三维管道设计软件,三维工厂设计软件,三维配管软件1PDMS螺栓概述在PDMS中螺栓数据是通过计算得到的,因为没有对螺......