Skip to content

Latest commit

 

History

History
95 lines (84 loc) · 2.75 KB

File metadata and controls

95 lines (84 loc) · 2.75 KB
title ferror | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-standard-libraries
ms.tgt_pltfrm
ms.topic article
apiname
ferror
apilocation
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-stdio-l1-1-0.dll
apitype DLLExport
f1_keywords
ferror
dev_langs
C++
helpviewer_keywords
ferror function
streams, testing for errors
errors [C++], testing for stream
ms.assetid 528a34bc-f2aa-4c3f-b89a-5b148e6864f7
caps.latest.revision 13
author corob-msft
ms.author corob
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

ferror

Tests for an error on a stream.

Syntax

int ferror(   
   FILE *stream   
);  

Parameters

stream
Pointer to FILE structure.

Return Value

If no error has occurred on stream, ferror returns 0. Otherwise, it returns a nonzero value. If stream is NULL, ferror invokes the invalid parameter handler, as described in Parameter Validation. If execution is allowed to continue, this function sets errno to EINVAL and returns 0.

See _doserrno, errno, _sys_errlist, and _sys_nerr for more information on these, and other, error codes.

Remarks

The ferror routine (implemented both as a function and as a macro) tests for a reading or writing error on the file associated with stream. If an error has occurred, the error indicator for the stream remains set until the stream is closed or rewound, or until clearerr is called against it.

Requirements

Function Required header
ferror <stdio.h>

For additional compatibility information, see Compatibility in the Introduction.

Example

See the example for feof.

See Also

Error Handling
Stream I/O
clearerr
_eof
feof
fopen, _wfopen
perror, _wperror