Error Handling (CRT)

 

The latest version of this topic can be found at Error Handling (CRT).

Use these routines to handle program errors.

Error-Handling Routines

Routine Use .NET Framework equivalent
assert macro Test for programming logic errors; available in both the release and debug versions of the run-time library System::Diagnostics::Debug::Assert
_ASSERT, _ASSERTE macros Similar to assert, but only available in the debug versions of the run-time library System::Diagnostics::Debug::Assert
clearerr Reset error indicator. Calling rewind or closing a stream also resets the error indicator. Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_eof Check for end of file in low-level I/O Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
feof Test for end of file. End of file is also indicated when _read returns 0. Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
ferror Test for stream I/O errors Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_RPT, _RPTF macros Generate a report similar to printf, but only available in the debug versions of the run-time library Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_set_error_mode Modifies __error_mode to determine a non-default location where the C run time writes an error message for an error that will possibly end the program.
_set_purecall_handler Sets the handler for a pure virtual function call.

See Also

Run-Time Routines by Category