std::feof
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <cstdio>
|
||
int feof( FILE* stream ); |
||
Controlla se la fine del flusso di file specificato è stato raggiunto.
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.
Indice |
[modifica] Parametri
stream | - | il flusso di file da controllare
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. |
[modifica] Valore di ritorno
Valore diverso da zero se la fine del flusso è stato raggiunto, altrimenti 0.
Original:
Nonzero value if the end of the stream has been reached, otherwise 0.
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.
[modifica] Note
Questa funzione riporta solo lo stato corrente come riportato dal più recente I / O, non esamina l'origine dati associata. Ad esempio, se il più recente I / O è un std::fgetc, che restituito l'ultimo byte del file,
std::feof
restituisce non-zero. Il std::fgetc successivo non riesce e modifica lo stato corrente di fine del file. Solo allora std::feof
restituisce zero.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 std::fgetc, which returned the last byte of a file,
std::feof
returns non-zero. The next std::fgetc fails and changes the stream state to end-of-file. Only then std::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.
Nell'uso tipico, trattamento di flussi di input si ferma in caso di errori,
feof
e std::ferrror vengono poi utilizzati per distinguere tra diverse condizioni di errore.Original:
In typical usage, input stream processing stops on any error;
feof
and std::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.
[modifica] Esempio
#include <cstdio> #include <cstdlib> int main() { FILE* fp = std::fopen("test.txt", "r"); if(!fp) { std::perror("File opening failed"); return EXIT_FAILURE; } int c; // note: int, not char, required to handle EOF while ((c = std::fgetc(fp)) != EOF) { // standard C I/O file reading loop std::putchar(c); } if (std::ferror(fp)) std::puts("I/O error when reading"); else if (std::feof(fp)) std::puts("End of file reached successfully"); }
[modifica] Vedi anche
controlli se end-of-file è stato raggiunto Original: checks if end-of-file 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. (metodo pubblico) | |
cancella errori 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. (funzione) | |
visualizza una stringa di caratteri del corrispondente errore di corrente 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. (funzione) | |
assegni per un errore di file 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. (funzione) | |
C documentation for feof
|