feof
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
| Definido en el archivo de encabezado <stdio.h>
|
||
int feof( FILE *stream ); |
||
Comprueba si el fin de la secuencia de archivo dado se ha alcanzado .
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.
Parámetros
| stream | - | la secuencia de archivo para comprobarlo
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 distinto de cero si el final de la secuencia se ha alcanzado, de lo contrario
0Original:
nonzero value if the end of the stream has been reached, otherwise
0The 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.
Notas
Esta función sólo informa sobre el estado corriente según lo informado por la más reciente operación I / O, no examina el origen de datos asociado. Por ejemplo, si la más reciente de E / S fue un
fgetc, que devuelve el último byte de un archivo, feof devuelve no-cero. El próximo fgetc falla y cambia el estado corriente de al final de su archivo. Sólo entonces feof devuelve cero .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.
You can help to correct and verify the translation. Click here for instructions.
En el uso típico, el procesamiento de flujo de entrada se detiene en cualquier error;
feof ferrror y se utilizan entonces para distinguir entre diferentes circunstancias de error .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.
You can help to correct and verify the translation. Click here for instructions.
Ejemplo
Ejecuta este código
#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");
}
Ver también
borra los errores 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. (función) | |
| muestra una cadena de caracteres correspondiente al error actual a stderr (función) | |
comprueba si hay un error de archivo 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. (función) | |
Documentación de C++ para feof
| |