◐ Shell
clean mode source ↗

std::feof - cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Definido no cabeçalho

<cstdio>

int feof( FILE* stream );

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.
You can help to correct and verify the translation. Click here for instructions.

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 std::fgetc, que retornou o último byte de um arquivo, std::feof retorna não-zero. O std::fgetc próxima falha e muda o estado de fluxo para' fim-de-arquivo. Só então std::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 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.

Em utilização normal, o processamento pára no fluxo de entrada de qualquer erro, e feof std::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 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.

Exemplo

#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");
}

Veja também

verifica se fim-de-arquivo foi atingido

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.


(of std::basic_ios função pública membro) [edit]

elimina erros

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.


(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.
You can help to correct and verify the translation. Click here for instructions.


(função) [edit]

verifica um erro de arquivo

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.


(função) [edit]