RTC Sample: Run-Time Error Checks
The RTC sample shows how to use the C run-time library's run-time error check feature.
When you load this project into the development environment, you will notice two custom build configurations:
Notice that the rtcsamp.cpp file contains the code that causes the bugs that are reported.
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.
To get samples and instructions for installing them:
On the Visual Studio Help menu, click Samples.
For more information, see Visual Studio Samples.
The most recent version and complete list of samples is available online from the Visual Studio 2008 Samples page.
You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied into a folder under \Program Files\Visual Studio 9.0\Samples\. For Express editions of Visual Studio, all samples are located online.
To build and run this sample
Open the solution rtcsample.sln.
From the Build menu, click Build.
From the Debug menu, select Start Without Debugging.
If you debug this project, you will see the Visual Studio debugger support for run-time error checks. That is, you will see the debugger's error reporting mechanism. The debugger's support for reporting run-time error checks is independent of whether you use the C run-time library.
This sample uses the following keywords:
_RTC_error_fn; _RTC_ErrorNumber; _crt_rtc_init; _rtc_geterrdesc; _rtc_initialize; _rtc_seterrorfunc; _rtc_terminate; catch_rtc_failure; defined; interlockedexchange; intrinsic; messagebox; sleep; sprintf_s; strcat_s; strcpy_s; va_arg; va_end; va_start; vsprintf_s; winmain