字符到整形:
1.HBufC->TInt
TInt num;
HBufC16* buf = HBufC16::NewLC(aSize);
buf->Des().Copy(apSrc, aSize);
HBufC8* buf8 = HBufC8::NewLC(aSize+1);
buf8->Des().Copy(buf->Des());
buf8->Des().ZeroTerminate();
char* p = (char *)(buf8->Des().Ptr());
num= atoi(p);
2.a/
TBuf->TInt
TBuf<12> buf(_L("1234"));
TInt a;
TLex iLex(buf);
iLex.Val(a);
b/
InetProtTextUtils::ConvertDescriptorToInt(const TDesC8& aData, TInt& aInt) //InetProtTextUtils.h inetprotutil.lib
3.获取当前激活viewid
TVwsViewId viewId;
GetActiveViewId(viewId);
viewId.iViewUid == KAppViewIdThird
4.如果Eclipse启动找不到插件了,解决办法: 在/configuration/config.ini文件中加入一行
osgi.checkConfiguration=true
5.armv5编译:
bldmake bldfiles
abld build armv5
mmp OPTION ARMCC --arm
gcce 在源文件里面是可以用__GCCE__ 和__ARMCC__来区分的
在mmp中GCCE和ARMCC
ARM编译器编译,在源文件 通过__GNUC__和__arm__来区别
6.symbian的编辑框换行是 /f
9.系统宏定义
_DEBUG __WINS__ __SYMBIAN32__ __SERIES60_2X__ __SERIES60_3X__ __UIQ_2x__ __UIQ_3x__
__S60_50__
10.
TSize size(iCoeEnv->ScreenDevice()->SizeInPixels());
11. illegal use of incomplete struct/union/class 'CEikAppUi'
++ #include <EIKAPP.H>
++ #include "***AppUi.h"
CFont lib->gdi.lib
11.HBufC *buf = CEikonEnv::Static()->AllocReadResourceL(id)
=StringLoader::LoadL(id)
CleanupStack::PushL(buf);
CleanupStack::PopAndDestroy(); //不能用Pop()
12 RPointerArray 排序
.h
RPointerArray<HBufC> iListArray;
static TInt CompareHBufC(const HBufC& aLeft, const HBufC& aRight);
.cpp
TLinearOrder<HBufC> order(C***::CompareHBufC);
iListArray.Sort(order);
TInt C***::CompareHBufC(const HBufC& aLeft, const HBufC& aRight)
{
return aLeft.Compare(aRight);
}
13.wserv 7 错误
可能由于载入资源时,路径不对
14.获取私有路径
CEikonEnv* pEikEnv = 0;
pEikEnv = CEikonEnv::Static();
pEikEnv->FsSession().PrivatePath( aBuf );
CEikApplication* pApp = ( REINTERPRET_CAST( CEikAppUi*, pEikEnv->AppUi() ) )->Application();
TFileName appPath;
if ( 0 != pApp )
{ appPath = pApp->AppFullName(); }
if ( appPath.Length() > 0 )
{
TParsePtr parse(appPath);
aBuf.Insert( 0, parse.Drive() );
}
else
{
_LIT( KRlDesDriveC, "c:" );
aBuf.Insert( 0, KRlDesDriveC );
}
if ( aBuf.Length() > 0 )
{
BaflUtils::EnsurePathExistsL( pEikEnv->FsSession(), aBuf );
}
15.关于数组模板的问题
RArray< RArray<TPoint> > iArray;//申明时中间空格是必须的
释放时,必须
for(TInt i=0;i<iArray.Count();i++)
{
iArray[i].Reset();
}
iArray.Reset();