std::ferror
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| Definido no cabeçalho <cstdio>
|
||
int ferror( FILE *stream ); |
||
Verifica o fluxo determinado por erros.
Original:
Checks the given stream for errors.
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 | - | 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 fluxo de arquivo tem erros,
0 contrário Original:
Nonzero value if the file stream has errors occurred,
0 otherwise 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.
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
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) | |
cheques para o fim-de-arquivo Original: checks for the end-of-file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
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) | |
Documentação C para ferror
|