I face system error when I try to run my program..... 😞
Below is my code....
myProgramappui.cpp
------------------------------
const TPtrC KTestFile=_L("C:\\System\\apps\\testdata\\testdata.dat"😉;
const TUint8* KTestData=_S8("12345\n"😉;
const TInt KTestLength=5;
const TPtrC8 KTestDes(KTestData,KTestLength);
void CTestdataAppUi::HandleCommandL(TInt aCommand)
{
switch ( aCommand )
{
case EAknSoftkeyBack:
case EEikCmdExit:
{
Exit();
break;
}
case EtestdataCmdAppTest:
{
Write();
break;
}
default:
break;
}
}
void CTestdataAppUi::Write()
{
TBuf8<KTestLength+1> buf;
RFs TheFs;
RFile file;
User::LeaveIfError(TheFs.Connect());
User::LeaveIfError(file.Open(TheFs,KTestFile,EFileWrite));
RFile f=file;
RFileWriteStream out(f);
out.WriteL(KTestDes);
out.CommitL();
TInt iFileSize;
file.Size(iFileSize);
out.Attach(file, iFileSize);
out.WriteL(KTestDes);
out.Close();
TheFs.Close();
}
myprogramcontainer.cpp
----------------------------------
const TPtrC KTestFile=_L("C:\\System\\apps\\testdata\\testdata.dat"😉;
void CTestdataContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
RFs TheFs;
RFile file;
TBuf8<50> buf;
User::LeaveIfError(TheFs.Connect());
User::LeaveIfError(file.Open(TheFs,KTestFile,EFileRead));
RFile f=file;
RFileReadStream in(f);
in.ReadL(buf);
in.Close();
TheFs.Close();
HBufC* buf16 = HBufC::NewLC(buf.Length());
buf16->Des().Copy(buf);
iLabel = new (ELeave) CEikLabel;
iLabel->SetContainerWindowL( *this );
iLabel->SetTextL(* buf16);
CleanupStack::PopAndDestroy(buf16);
SetRect(aRect);
ActivateL();
}
any one know how to solve this problem?
I know there are no global variable in symbian...but anyone know how to reference variables and contansts for different classes....like I want to reference variables and contansts in appui from container class....
million thanks in advance..... 😊