Namensräume
Varianten
Aktionen

errno

Aus cppreference.com
< c‎ | error

 
 
Fehlerbehandlung
Fehlercodes
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.
Fehlercodes
errno
Assertions
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
 
definiert in Header <errno.h>
#define errno /*implementation-defined*/
errno ist ein Präprozessor-Makro, die zu einer lokalen Thread-modifizierbare lvalue vom Typ int erweitert. Mehrere Standard-Library-Funktionen zeigen Fehler, indem er positive Ganzzahlen errno. Typischerweise wird der Wert errno einer der Fehlercodes, in <errno.h> als Makro-Konstanten aufgeführt, die mit dem Buchstaben E beginnen, durch Großbuchstaben oder Ziffern gesetzt .
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.
Der Wert der errno ist 0 beim Programmstart, und obwohl Bibliotheksfunktionen dürfen positive Ganzzahlen errno schreiben, ob ein Fehler aufgetreten ist, Bibliotheks-Funktionen speichern niemals 0 in errno .
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.

[Bearbeiten] Beispiel

#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

[Bearbeiten] Siehe auch

Makros für Standard-POSIX-kompatiblen Fehlerbedingungen
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.

(Makro konstant) [edit]
zeigt eine Zeichenfolge entspricht der aktuellen Fehler 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.

(Funktion) [edit]
gibt einen Text-Version eines bestimmten Fehlercode
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.

(Funktion) [edit]