home *** CD-ROM | disk | FTP | other *** search
- void StartDebugging()
- {
-
- #ifdef _DEBUG
-
- hFile= CreateFile("error.log",GENERIC_WRITE,FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
-
- if (hFile)
- {
- _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
- _CrtSetReportFile(_CRT_WARN, hFile);
- _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
- _CrtSetReportFile(_CRT_ERROR, hFile);
- _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
- _CrtSetReportFile(_CRT_ASSERT, hFile);
- }
-
- _RPT0(_CRT_WARN, "Start Debug Reporting\r\n" );
-
- #endif
- };
-
- void StopDebugging()
- {
- #ifdef _DEBUG
-
- _RPT0(_CRT_WARN, "Stop Debug Reporting\r\n" );
-
- if (hFile)
- CloseHandle(hFile);
-
- #endif
- };
-
- int main( int argc, char *argv[ ], char *envp[ ] )
- {
- StartDebugging();
-
- // The Code
-
- StopDebugging();
- return(0);
- }
-