feof
Aus cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| definiert in Header <stdio.h>
|
||
int feof( FILE *stream ); |
||
Prüft, ob das Ende der angegebenen Datei-Stream erreicht wurde .
Original:
Checks if the end of the given file stream has been reached.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Parameter
| stream | - | der Datei-Stream zu überprüfen
Original: the file stream to check The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Rückgabewert
Null-Wert, wenn das Ende des Stroms erreicht ist, andernfalls
0Original:
nonzero value if the end of the stream has been reached, otherwise
0The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Notes
Diese Funktion meldet nur den Strom Staat als von der jüngsten I / O-Operation berichtet, ist es nicht untersuchen die zugeordneten Datenquellen. Zum Beispiel, wenn die neueste I / O war ein
fgetc, das das letzte Byte einer Datei zurückgeführt, kehrt feof ungleich Null. Der nächste fgetc ausfällt und ändert den Strom Staat end-of-file. Erst dann feof Null zurück .Original:
This function only reports the stream state as reported by the most recent I/O operation, it does not examine the associated data source. For example, if the most recent I/O was a
fgetc, which returned the last byte of a file, feof returns non-zero. The next fgetc fails and changes the stream state to end-of-file. Only then feof returns zero.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
In der typischen Anwendung, stoppt Input Stream Processing bei jedem Fehler;
feof und ferrror werden dann verwendet, um zwischen verschiedenen Fehlerbedingungen unterscheiden .Original:
In typical usage, input stream processing stops on any error;
feof and ferrror are then used to distinguish between different error conditions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Beispiel
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE* fp = fopen("test.txt", "r");
if(!fp) {
perror("File opening failed");
return EXIT_FAILURE;
}
int c; // note: int, not char, required to handle EOF
while ((c = fgetc(fp)) != EOF) { // typical file reading loop
putchar(c);
}
if (ferror(fp))
puts("I/O error when reading");
else if (feof(fp))
puts("End of file reached successfully");
}
Siehe auch
löscht Fehler Original: clears errors The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
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) | |
Prüfungen für eine Datei Fehler Original: checks for a file error The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
C++ documentation for feof
| |