#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. ltp-ddt makefile的思考

    ltp-ddt env.sh export PATH=/opt/gcc-linaro--2018.05-x86_64_arm-linux-gnueabihf/bin:$PATH export CROS ...

  2. 2、Kafka架构

    Kafka架构图 1)Producer :消息生产者,就是向kafka broker发消息的客户端. 2)Consumer :消息消费者,向kafka broker取消息的客户端 3)Topic :可 ...

  3. Python pyc知识了解

    pyc 是什么 1. Python是一门解释型语言? 我初学Python时,听到的关于Python的第一句话就是,Python是一门解释性语言,我就这样一直相信下去,直到发现了*.pyc文件的存在.如 ...

  4. DataFrame数据转为list,再逐行写入Excel

    首先使用np.array()函数把DataFrame转化为np.ndarray(), 再利用tolist()函数把np.ndarray()转为list, 示例代码如下: # -*- coding:ut ...

  5. time&datetime模块详解

     一.time模块 1.时间格式转换图: 2.time模块中时间表现的格式主要有三种: a.timestamp时间戳,时间戳表示的是从1970年1月1日00:00:00开始按秒计算的偏移量 b.for ...

  6. Windows server 2016安装Docker EE

    Windows server 2016安装Docker EE 下载 windows server 2016 180天评估版本. 地址:https://www.microsoft.com/en-us/e ...

  7. Python3 tkinter基础 OptionMenu 将list导入下拉列表中

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  8. Java Volatile关键字 以及long,double在多线程中的应用

    概念: volatile关键字,官方解释:volatile可以保证可见性.顺序性.一致性. 可见性:volatile修饰的对象在加载时会告知JVM,对象在CPU的缓存上对多个线程是同时可见的. 顺序性 ...

  9. C++ 将 std::string 转换为 char*

    参考: std::string to char* C++ 将 std::string 转换为 char* 目前没有直接进行转换的方法.必须通过string对象的c_str()方法,获取C-style的 ...

  10. 03.v-cloak、v-v-text、v-html、v-bind、v-on

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...