Share via


clearerr (Windows CE 5.0)

Send Feedback

Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference

Resets the error indicator for a stream

void clearerr(    FILE*stream);

Parameters

  • stream
    Pointer to FILE structure.

Return Values

None.

Remarks

The clearerr function resets the error indicator and end-of-file indicator for stream.

Error indicators are not automatically cleared; after the error indicator for a specified stream is set, operations on that stream continue to return an error value until clearerr, fseek, or fsetpos is called.

Example

/* CLEARERR.C: This program creates an error
 * on the standard input stream, then clears
 * it so that future reads won't fail.
 */

#include <stdio.h>

void main( void )
{
   int c;
   /* Create an error by writing to standard input. */
   putc( 'c', stdin );
   if( ferror( stdin ) )
   {
      printf( "Write error" );
      clearerr( stdin );
   }

   /* See if read causes an error. */
   printf( "Will input cause an error? " );
   c = getc( stdin );
   if( ferror( stdin ) )
   {
      printf( "Read error" );
      clearerr( stdin );
   }
}

Output

Write error: No error
Will input cause an error? n

Requirements

OS Versions: Windows CE 2.0 and later.
Header: stdlib.h.
Link Library: coredll.dll.

See Also

feof | ferror

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.