hi every one PushL,shilpa13 and manchb for showing interest in replying....i tried using the way manchb told me...
actually m a newbie to symbian so it seems easier to prefer code..though also tryied my hands by doing it at my own but ...
m giving my code here....plz take a look n tell whats wrong wid it....
its showing error in d console saying....."failed: leave code=-1[press any key]"
as it is defined in callConsoleTemplateL() func....
thanks in advance
regards,
mayank
here is d code....
PHP Code:
#include <e32debug.h>
#include <e32base.h>
#include <e32cons.h>
#include <f32file.h>
_LIT(KTxtCLHERAAPP,"CLHERA_APPLICATIONS");
_LIT(KTxtClheraApplicationCode,"Program To Copy A File");
_LIT(KFormatFailed,"failed: leave code=%d");
_LIT(KTxtOK,"ok");
_LIT(KTxtPressAnyKey," [press any key]");
_LIT(oldFile,"c:\\oldfile.txt");
_LIT(newFile,"c:\\newfile\\");
// public
LOCAL_D CConsoleBase* console;
LOCAL_C void doConsoleTemplateL();
// private
LOCAL_C void callConsoleTemplateL();
GLDEF_C TInt E32Main()
{
__UHEAP_MARK;
CTrapCleanup* cleanup=CTrapCleanup::New();
TRAPD(error,callConsoleTemplateL());
__ASSERT_ALWAYS(!error,User::Panic(KTxtCLHERAAPP,error));
delete cleanup;
__UHEAP_MARKEND;
return 0;
}
LOCAL_C void callConsoleTemplateL()
{
console=Console::NewL(KTxtClheraApplicationCode,TSize(KConsFullScreen,KConsFullScreen));
CleanupStack::PushL(console);
TRAPD(error,doConsoleTemplateL(););
if (error)
console->Printf(KFormatFailed, error);
else
console->Printf(KTxtOK);
console->Printf(KTxtPressAnyKey);
console->Getch();
CleanupStack::PopAndDestroy();
}
LOCAL_C void doConsoleTemplateL()
{
#ifdef _CLHERADEBUG
RDebug::Print(_L16("CLHERA_DBGMSG In DoConsoleTemplateL"));
#endif
// make and install the active scheduler
RDebug::Print(_L16("CLHERA_DBGMSG before active scheduler"));
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
CleanupStack::PushL(scheduler); // push to clean-up stack
CActiveScheduler::Install(scheduler); // install as active scheduler
TUint ch;
while(1)
{
RFs lSess;
User::LeaveIfError(lSess.Connect());
CFileMan* lFlMan = CFileMan::NewL(lSess);
User::LeaveIfError(lFlMan->Copy(oldFile,newFile));
delete lFlMan;
lFlMan = NULL;
lSess.Close();
ch = console->Getch();
RDebug::Printf("CLHERA_DBGMSG getch: %d",ch);
}
CleanupStack::PopAndDestroy(); // scheduler
}