#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. 获取JS数组中所有重复元素

    //获取数组内所有重复元素,并以数组返回 //例:入参数组['1','2','4','7','1','2','2'] 返回数组:['1','2'] function GetRepeatFwxmmc(a ...

  2. hisi 生产固件生成

    生产需求,需要16M bin 文件 给 spi flash烧写 一般有三种方式 1.把文件都导入flash,拆了flash 用烧录器读取,比较可靠! 2.编译时候合并,需要在空余地方填充0xFF拼成1 ...

  3. 使用 mysqladmin debug 查看死锁信息

    使用 mysqladmin debug 查看死锁信息 mysqladmin -S /mysql/data/mysql.sock debug 然后在error日志中,会看到: 11 lock struc ...

  4. nginx-编译安装 第一章

    nginx 第一章:编译安装 nginx 官网网站:http://nginx.org/en/ 1.基础说明 基本HTTP服务器功能其他HTTP服务器功能邮件代理服务器功能TCP/UDP代理服务器功能体 ...

  5. Docket 使用命令

    Docket 使用命令 查 # 查询当前可以下载的镜像 docker search httpd  |_ NAME:镜像仓库源的名称 |_ DESCRIPTION:镜像的描述 |_ OFFICIAL:是 ...

  6. Python socket文件传送md5校验

    soket_server import socket,os,hashlib server = socket.socket() server.bind(('0.0.0.0',9999)) server. ...

  7. Dockerfile构建容器---构建本地tomcat

    前序 这是我第一次摸索.做个笔记记录一下. 首先准备好tomcat与jdk解压到与Dockerfile同级的目录下, 构建文件命名必须为Dockerfile, 为什么同级, 因为build的时候会默认 ...

  8. maven开发项目中遇到的问题

    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start com ...

  9. linux --- 5. nginx 初始

    一. 安装nginx 1.安装nginxz之前的依赖包 yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel o ...

  10. js打开新页面的方式:

    1.超链接<a href="http://www.jb51.net" title="脚本之家">Welcome</a>等效于js代码wi ...