1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| //------------------ Manage debug ----------------------
// Deviate the cerr stream in a debug file
ofstream debug("debug.log");
basic_streambuf<char,std::char_traits<char> > *cerrbuf=cerr.rdbuf();
if ( debug ) cerr.rdbuf(debug.rdbuf());
try {
try
{
Application->Initialize();
SetApplicationMainFormOnTaskBar(Application, true);
Application->CreateForm(__classid(TForm6), &Form6);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
}
__finally {
//------------------ Manage debug ----------------------
// Cancel the deviation of the cerr stream
if (debug) {
cerr.rdbuf(cerrbuf);
debug.close();
}
}
return 0;
} |
Partager