3,119
社区成员
发帖
与我相关
我的任务
分享
void DoTheThingsForMeL(CConsoleBase* aConsole)
{
//Do something here.
}
void DoExampleL()
{
CConsoleBase* console;
// Make the console and push it on the cleanup stack.
console = Console::NewL(_L("Console"), TSize( KConsFullScreen, KConsFullScreen));
CleanupStack::PushL(console);
DoTheThingsForMeL(console);
CleanupStack::PopAndDestroy(console);
}
TInt E32Main()
{
__UHEAP_MARK;
//Create a cleanup stack
CTrapCleanup* cleanup = CTrapCleanup::New();
//Call some Leaving methods inside TRAP
TRAPD(error, DoExampleL());
__ASSERT_ALWAYS(!error, User::Panic(KAPConsoleTest, error));
//Destroy cleanup stack
delete cleanup;
__UHEAP_MARKEND;
return 0;
}
__UHEAP_MARK;
CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
TRAPD(error,YourWorkHereL()); // more initialization
__ASSERT_ALWAYS(!error,User::Panic(KTxtEPOC32EX,error));
delete cleanup; // destroy clean-up stack
__UHEAP_MARKEND;