Error Handling (CRT)

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

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

Use these routines to handle program errors.

Error-Handling Routines

RoutineUse.NET Framework equivalent
assert macroTest for programming logic errors; available in both the release and debug versions of the run-time librarySystem::Diagnostics::Debug::Assert
_ASSERT, _ASSERTE macrosSimilar to assert, but only available in the debug versions of the run-time librarySystem::Diagnostics::Debug::Assert
clearerrReset 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.
_eofCheck for end of file in low-level I/ONot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
feofTest 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.
ferrorTest for stream I/O errorsNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_RPT, _RPTF macrosGenerate a report similar to printf, but only available in the debug versions of the run-time libraryNot applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
_set_error_modeModifies __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_handlerSets the handler for a pure virtual function call.

Run-Time Routines by Category

Show: