#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. Determine YARN and MapReduce Memory Configuration Settings

    Determine YARN and MapReduce Memory Configuration Settings https://docs.hortonworks.com/HDPDocuments ...

  2. 【mysql】逗号分割字段的行列转换

    由于很多业务表因为历史原因或者性能原因,都使用了违反第一范式的设计模式,即同一个列中存储了多个属性值.这种模式下,应用常常需要将这个列依据分隔符进行分割,并得到列转行的结果:这里使用substring ...

  3. Linux系统组成

     1 系统组成 BootLoader:操作系统引导程序 内核: 文件系统:应用程序(用户开发的.网上下载的) 2 安装USB驱动 dongry@d-linux:~$ insmod usb_dnw.ko ...

  4. Delphi10.2 Tokyo试用(1)

    最近下载了Delphi10.2 Tokyo,试用了一下,感觉不错,尤其是针对Linux的开发,总算出来了,可以考虑把原来服务器重新编译成RedHat上使用了,免得客户一天到晚喊Windows不安全,要 ...

  5. openwrt为何需要refresh新增的补丁?

    答:为了避免应用新补丁时出现无法应用的问题 如普通package的补丁refresh: make package/example/refresh V=s 如kernel的补丁refresh: make ...

  6. tomcat启动后8005端口未被占用

    8005端口是tomcat本身的端口,如果这个端口在启动时未被tomcat占用的话,就无法使用它自带的shutdown.sh脚本关闭tomcat 接下来我以tomcat-9.0.12为例说明 下载to ...

  7. 问题1——之Linux虚拟机ip地址消失

    原文转自 https://blog.csdn.net/keep_walk/article/details/75115926 以前一直通过ifconfig命令查看ip地址,但是今天用XShell连接自己 ...

  8. 如何使用 Deepfakes 换脸

    如何使用 Deepfakes 换脸 1. 获取deepfakes工具包 git clone https://github.com/deepfakes/faceswap.git 2. 补齐依赖包: pi ...

  9. Python自学:第二章 浮点数

    >>>0.1 + 0.1 0.2 >>>0.2 + 0.2 0.4 >>>2 * 0.1 0.2 >>>2 * 0.2 0.4

  10. vue分页控件

    下载:https://pan.baidu.com/s/1c125Vgc 一个简单的分页控件: 自动加载模式: 手动加载模式: loading图标使用了iconfont: 主要方法: beginRefr ...