_Exit
提供: cppreference.com
ヘッダ <stdlib.h> で定義
|
||
void _Exit( int exit_code ); |
(C99以上) (C11未満) |
|
_Noreturn void _Exit( int exit_code ); |
(C11以上) | |
リソースの完全なクリーンを行わずにプログラムの正常終了を発生させます。
at_quick_exit() または atexit() に渡した関数は呼ばれません。 バッファリングされているまだ書き込まれていないデータを持つ開いているストリームがフラッシュされるかどうか、開いているストリームが閉じられるかどうか、一時ファイルが削除されるかどうかは処理系定義です。
exit_code
が 0 または EXIT_SUCCESS であれば、成功終了を表す処理系定義のステータスがホスト環境に返されます。 exit_code
が EXIT_FAILURE であれば、失敗終了を表す処理系定義のステータスが返されます。 それ以外の場合は、処理系定義のステータス値が返されます。
目次 |
[編集] 引数
exit_code | - | プログラムの終了ステータス |
[編集] 戻り値
(なし)
[編集] 例
Run this code
#include <stdlib.h> #include <stdio.h> /* _Exit does not call functions registered with atexit. */ void f1(void) { puts("pushed first"); } void f2(void) { puts("pushed second"); } int main(void) { printf("Enter main()\n"); atexit(f1); atexit(f2); fflush(stdout); /* _Exit may not flush unwritten buffered data */ _Exit(0); }
出力:
Enter main()