title: Equivalent to "SIGINT" (posix) signal for catching "CTRL+C" under Windows/MinGW
body: <p>I am porting a Linux/gcc program under windows and implemented common exceptions handling for both. I was wondering what would be the equivalent of <code>SIGINT</code> signal for MinGW/gcc.</p>
  
  <p>Here is how I handle it under Linux :</p>
  
  <pre><code>static void handler(int sig)
  {
      // Catch exceptions
      switch(sig)
      {
      case SIGABRT:
          fputs("Caught SIGABRT: usually caused by an abort() or assert()\n", stderr);
          break;
      case SIGFPE:
          fputs("Caught SIGFPE: arithmetic exception, such as divide by zero\n",
                  stderr);
          break;
      case SIGILL:
          fputs("Caught SIGILL: illegal instruction\n", stderr);
          break;
      case SIGINT:
          fputs("Caught SIGINT: interactive attention signal, probably a ctrl+c\n",
                  stderr);
          break;
      case SIGSEGV:
          fputs("Caught SIGSEGV: segfault\n", stderr);
          break;
      case SIGTERM:
      default:
          fputs("Caught SIGTERM: a termination request was sent to the program\n",
                  stderr);
          break;
      }
  
      // Ctrl+C interrupt =&gt; No backtrace
      if (sig != (int)SIGINT)
      {
          fprintf(stderr, "Error: signal %d:\n", sig);
          posix_print_stack_trace();
      }
      exit(sig);
  
  }
  
  signal(SIGABRT, handler);
  signal(SIGFPE,  handler);
  signal(SIGILL,  handler);
  signal(SIGINT,  handler);
  signal(SIGSEGV, handler);
  signal(SIGTERM, handler);
  </code></pre>
  
  <p>Under Windows, this looks like :</p>
  
  <pre><code>static LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS * ExceptionInfo)
  {
      switch(ExceptionInfo-&gt;ExceptionRecord-&gt;ExceptionCode)
      {
      case EXCEPTION_ACCESS_VIOLATION:
          fputs("Error: EXCEPTION_ACCESS_VIOLATION\n", stderr);
          break;
      case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
          fputs("Error: EXCEPTION_ARRAY_BOUNDS_EXCEEDED\n", stderr);
          break;
      case EXCEPTION_BREAKPOINT:
          fputs("Error: EXCEPTION_BREAKPOINT\n", stderr);
          break;
  
      ...
      }
  }
  
  if (EXCEPTION_STACK_OVERFLOW != ExceptionInfo-&gt;ExceptionRecord-&gt;ExceptionCode)
  {
      windows_print_stacktrace(ExceptionInfo-&gt;ContextRecord);
  }
  </code></pre>
  
  <p>My problem is that I don't see any equivalent of <code>SIGINT</code> in the <code>EXCEPTION_*</code> available for Windows.</p>
  
  <p>How would it be done catching a "CTRL+C" interruption under Windows (MinGW/gcc) ?</p>
  
  <p>Thanks a lot.</p>