◐ Shell
clean mode source ↗

feof — cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Déclaré dans l'en-tête

<stdio.h>

int feof( FILE *stream );

Vérifie si la fin du flux de fichier donné a été atteint .

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.

Paramètres

stream -

le flux de fichier à vérifier

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.

Retourne la valeur

valeur différente de zéro si la fin du flux a été atteinte, sinon 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.

Notes

Cette fonction signale que l'état courant tel que rapporté par la plus récente opération E / S, il n'examine pas la source de données associée. Par exemple, si la plus récente d'E / S a été un fgetc, qui a retourné le dernier octet d'un fichier, feof renvoie une valeur non nulle. Le fgetc suivante échoue et modifie l'état de flux de fin-de-fichier. C'est alors seulement feof retourne zéro .

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.

En utilisation normale, le traitement des flux d'entrée s'arrête sur une erreur; feof et ferrror sont ensuite utilisés pour distinguer entre les différentes conditions d'erreur .

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.

Exemple

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

Voir aussi

efface les erreurs

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.


(fonction) [edit]

affiche une chaîne de caractères correspondant de l'erreur de courant à 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.


(fonction) [edit]

chèques pour une erreur de fichier

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.


(fonction) [edit]