feof - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Definido no cabeçalho <stdio.h> |
||
|
|
||
Verifica se o fim do fluxo determinado arquivo foi atingido.
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.
Parâmetros
| stream | - | o fluxo de arquivo para verificar Original: the file stream to check The text has been machine-translated via Google Translate. |
Valor de retorno
valor diferente de zero se o fim do fluxo foi atingido, de outro modo 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.
Notas
Esta função só informa o estado de fluxo, conforme relatado pelo mais recente operação I / O, que não examina a fonte de dados associado. Por exemplo, se o que eu mais recentes / O foi um fgetc, que retornou o último byte de um arquivo, feof retorna não-zero. O fgetc próxima falha e muda o estado de fluxo para' fim-de-arquivo. Só então feof retorna 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 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.
Em utilização normal, o processamento pára no fluxo de entrada de qualquer erro, e feof ferrror são então utilizados para distinguir entre as condições de erro diferentes.
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.
Exemplo
#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"); }
Veja também
elimina erros Original: clears errors The text has been machine-translated via Google Translate. (função) [edit] | |
exibe uma seqüência de caracteres correspondente do erro atual para stderr Original: displays a character string corresponding of the current error to stderr The text has been machine-translated via Google Translate. (função) [edit] | |
verifica um erro de arquivo Original: checks for a file error The text has been machine-translated via Google Translate. (função) [edit] | |
C++ documentation for feof | |