티스토리 뷰
MSDN
atexit
atexit 01/05/2008 읽는 데 2분 걸림 이 문서의 내용 --> Processes the specified function at exit. int atexit( void (__cdecl *func )( void ) ); Parameters funcFunction to be called. Return Value atexit returns 0 if successful, or a nonzero value i
docs.microsoft.com
int atexit( void (__cdecl *func )( void ) ); |
설명 : 프로그램 종료하는 함수로 종료 시 등록된 함수를 실행합니다.
파라미터는 종료 시 처리 할 함수포인터 입니다 .
반환값은 성공 할 경우 0(zero), 실패 할 경우 0이 아닌 값(nonzero)를 반환합니다.
주의사항 : 이미 언로드 될 수 있는 모든 DLL에 대한 의존성을 포함해서는 안됩니다.
// ConsoleApplication1.cpp : 기본 프로젝트 파일입니다.
#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
using namespace System;
void Test(void);
void Test_A(void);
void Test_B(void);
void Test(void)
{
printf("Test\n");
exit(0);//프로그램 종료
}
void Test_A(void)
{
printf("Test A\n");
}
void Test_B(void)
{
printf("Test B\n");
}
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
atexit(Test_A);
atexit(Test_B);
Test();
return 0;
}