Пространства имён
Варианты
Действия

feof

Материал из cppreference.com
< c | io

 
 
File input/output
Функции
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Доступ к файлам
Original:
File access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Прямой ввод / вывод
Original:
Direct input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
fread
fwrite
Неформатированная ввода / вывода
Original:
Unformatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Форматированный ввод / вывод
Original:
Formatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Позиционирование файла
Original:
File positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ftell
fgetpos
fseek
fsetpos
rewind
Обработка ошибок
Original:
Error handling
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
clearerr
feof
ferror
perror
Операции с файлами
Original:
Operations on files
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
remove
rename
tmpfile
tmpnam
 
Заголовочный файл <stdio.h>
int feof( FILE *stream );
Проверяет, является ли конец данного файла потока была достигнута.
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.

Содержание

[править] Параметры

stream -
поток файла для проверки
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.

[править] Возвращаемое значение

значение отличное от нуля, если конец потока была достигнута, в противном случае 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

Эта функция только сообщает потока государства, как сообщили в последней операции ввода / вывода, она не рассматривает соответствующего источника данных. Например, если самые последние I / O был fgetc, который вернулся последний байт файла, feof возвращает ненулевое значение. Следующий fgetc не удается, и изменяет состояние потока конца файла. Только тогда feof возвращает ноль.
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.
При обычном использовании, обработке входной поток останавливается на любые ошибки; feof и ferrror которые затем используются, чтобы различать различные условия ошибки.
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.

[править] Пример

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


[править] См. также

устраняет ошибки
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.

(функция) [edit]
выводит строку символов, соответствующая текущей ошибки 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.

(функция) [edit]
проверяет наличие файла ошибки
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.

(функция) [edit]