at_quick_exit - C stdlib.h

C examples for stdlib.h:at_quick_exit

Type

function

From


<cstdlib>
<stdlib.h>

Description

Set function to be executed on quick exit

Prototype

int at_quick_exit (void (*func)(void)) noexcept;
int at_quick_exit (void (*func)(void));

Parameters

Parameter Description
function Function to be called. The function shall return no value and take no arguments.

Return Value

A zero value is returned on success.

On error, a non-zero value is returned.

Demo Code


#include <stdio.h>
#include <stdlib.h>

void fnQExit (void)
{
  puts ("Quick exit function.");
}

int main ()//from   w  ww . j  ava2s  .co m
{
  at_quick_exit (fnQExit);

  puts ("Main function: Beginning");

  quick_exit (EXIT_SUCCESS);

  puts ("never executed");

  return 0;
}

Related Tutorials