C++ 编程/代码/标准 C 库/函数/atexit
外观
The Wikibooks community is developing a policy on the use of generative AI. Please review the draft policy and provide feedback on its talk page.
语法 |
#include <cstdlib>
int atexit( void (*func)(void) );
|
atexit() 函数使程序终止时调用 func 指向的函数。你可以多次调用 atexit()(至少 32 次,具体取决于你的编译器),这些函数将按照建立的相反顺序调用。atexit() 函数在成功时返回零,失败时返回非零值。