名前空間
変種
操作

errno

提供: cppreference.com
< c‎ | error

 
 
エラー処理
エラーコード
Original:
Error codes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
エラーコード
errno
アサーション
Original:
Assertions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
assert
 
Defined in header <errno.h>
#define errno /*implementation-defined*/
errnoタイプintのスレッドローカルな変更可能な左辺値に展開されるプリプロセッサマクロです。いくつかの標準ライブラリ関数はerrnoに正の整数を書き込むことで、エラーを示します。通常、errnoの値は大文字または数字が続く文字列の<errno.h>で始まるマクロ定数としてEに記載されている1エラー·コード、、に設定されています.
Original:
errno is a preprocessor macro that expands to a thread-local modifiable lvalue of type int. Several standard library functions indicate errors by writing positive integers to errno. Typically, the value of errno is set to one the error codes, listed in <errno.h> as macro constants that begin with the letter E, followed by uppercase letters or digits.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
errnoの値は、プログラムの起動時に0で、ライブラリ関数はエラーが発生したかどうかerrnoに正の整数を書き込みを許可されていますが、ライブラリ関数は0errnoを格納することはありません.
Original:
The value of errno is 0 at program startup, and although library functions are allowed to write positive integers to errno whether or not an error occurred, library functions never store 0 in errno.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
 
int main (int argc, char **argv)
{
	int fd = -1;
	fd = open ("/dev/zer0", O_RDONLY);
 
	if (errno)
	{
		perror ("Ouuupsss");
		exit (EXIT_FAILURE);
	}
 
	close (fd);
 
	return EXIT_SUCCESS;
}

Output:

Ouuupsss: No such file or directory

[編集] も参照してください

標準のPOSIX互換のエラー条件のためのマクロ
Original:
macros for standard POSIX-compatible error conditions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(マクロ定数) [edit]
stderrに現在のエラーの対応する文字列が表示されます
Original:
displays a character string corresponding of the current error to stderr
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]
指定したエラーコードのテキストバージョンを返します
Original:
returns a text version of a given error code
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]