#include "pch.h"
#include <iostream>
#include <csignal>
#include <windows.h> using namespace std; int i; void signalHandle(int signum)
{
cout << "Interrupt signal(" << signum << ")received" << endl;
i = signum;
} int main()
{
//注册信号以及信号处理程序
signal(SIGINT, signalHandle); while (1)
{
if (i == 2)
{
break;
}
cout << "hello..." << endl;
Sleep(1000);//暂停1s
} system("pause");
return 0;
}

参考

https://blog.csdn.net/qq_28796345/article/details/51290493

Windows10 VS2017 C++信号处理的更多相关文章

  1. Windows10 VS2017 C++编译Linux程序

    #include <cstdio> #include <iostream> #include "unistd.h" using namespace std; ...

  2. Windows10 VS2017 C++使用crypto++库加密解密(AES)

    参考文章: https://blog.csdn.net/tangcaijun/article/details/42110319 首先下载库: https://www.cryptopp.com/#dow ...

  3. Windows10+VS2017 用GLFW+GLAD 搭建OpenGL开发环境

    本文参考:https://learnopengl-cn.github.io/ 一 下载GLFW(https://www.glfw.org/download.html)  和 GLAD(https:// ...

  4. Windows10 VS2017 C++多线程传参和等待线程结束

    #include "pch.h" #include <iostream> #include <windows.h> using namespace std; ...

  5. Windows10 VS2017 C++模拟点击按键

    #include "pch.h" #include <Windows.h> #include <stdio.h> #include <iostream ...

  6. Windows10 VS2017 C++ ini解析(使用simpleini头文件)

    simpleini项目地址: https://github.com/brofield/simpleini 下载,新建项目,并将SimpleIni.h文件通过包含目录的方式加载进来. 创建test.in ...

  7. Windows10 VS2017 C++ xml解析(tinyxml2库)

    首先下载tinyxml2 7.0.1库: https://github.com/leethomason/tinyxml2/releases 打开tinyxml2,然后升级sdk,解决方案->重定 ...

  8. Windows10 VS2017 C++ Json解析(使用jsoncpp库)

    1.项目必须是win32 2.生成的lib_json.lib放到工程目录下 3.incldue的头文件放到工程目录,然后设置工程->属性->配置属性->vc++目录->包含目录 ...

  9. Windows10 VS2017 C++ Server Socket简单服务器端与客户端

    服务端: #include "pch.h" #include<iostream> #include<WinSock2.h> #include <Ws2 ...

随机推荐

  1. redis重要知识点

    redis是一种高级的key:value存储系统,其中value支持五种数据类型: 1.字符串(strings) 2.字符串列表(lists) 3.字符串集合(sets) 4.有序字符串集合(sort ...

  2. 从路由器镜像中提取uImage头信息

    uImage header为64字节,文件头为27 05 19 56 hexdump -C a.bin | grep "27 05 19 56" 或者 hd aa.bin | gr ...

  3. 使用js方法时,调用的方法名明明一致,但就是不管用,解决

    前提:代码全部写对 问题:调用的方法名明明一致,但就是不管用 举例:写了个function delete(){}方法, 点击调用delete方法,onclik="delete()" ...

  4. 分析hello1项目里面的web.xml

    在example目录下的web\jsf\hello1\target\hello1\WEB-INF路径里可以找到hello1的web.xml <?xml version="1.0&quo ...

  5. freeswitch设置支持视频语音编码

    1.修改FreeSWITCH安装路径下/conf/var.xml文件中,增加: <X-PRE-PROCESS cmd=="set" data="proxy_medi ...

  6. python之路——模块和包

    阅读目录 一 模块 3.1 import 3.2 from ... import... 3.3 把模块当做脚本执行 3.4 模块搜索路径 3.5 编译python文件 二 包 2.2 import 2 ...

  7. sql 根据表名查找存储过程

    SELECT obj.Name, sc.TEXT FROM syscomments sc INNER JOIN sysobjects obj ON sc.Id = obj.ID WHERE sc.TE ...

  8. Linux下Shell的for循环语句

    第一类:数字性循环-----------------------------for1-1.sh #!/bin/bash ;i<=;i++)); do + ); done ------------ ...

  9. Go 使用 JSON

    Encode 将一个对象编码成 JSON 数据,接受一个 interface{} 对象,返回 []byte 和 err func Marshal(v interface{}) {[]byte,err} ...

  10. Query the tables and index which will caus rebuild index fail

    On MSSQL server database, while rebuild index failed, we can use the follow sql statement to see if ...