atexit
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
| Definido en el archivo de encabezado <stdlib.h>
|
||
int atexit( void (*func)() ); |
||
Registra la función a la que apunta
func de ser llamado a la terminación normal del programa (a través de exit() o regresan de main()) .Original:
Registers the function pointed to by
func to be called on normal program termination (via exit() or returning from main()).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Llamar a la función de varios hilos no induce una carrera de datos. La implantación apoyará la inscripción de las funciones
32 por lo menos .Original:
Calling the function from several threads does not induce a data race. The implementation shall support the registration of at least
32 functions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Parámetros
| func | - | puntero a una función que se llama a la terminación normal del programa
Original: pointer to a function to be called on normal program termination The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Valor de retorno
0 si el registro tiene éxito, valor distinto de cero de otra manera .Original:
0 if the registration succeeds, nonzero value otherwise.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Excepciones
Ejemplo
Ejecuta este código
#include <stdlib.h>
#include <stdio.h>
void f1()
{
puts("pushed first");
}
void f2()
{
puts("pushed second");
}
int main()
{
atexit(f1);
atexit(f2);
}
Salida:
pushed second
pushed first
Ver también
(C99) |
registra una función para ser llamada en quick_exit invocación Original: registers a function to be called on quick_exit invocation The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función) |
Documentación de C++ para atexit
| |