WEB开发网
开发学院手机开发Symbian 开发 Symbian 开发中的一些小知识 阅读

Symbian 开发中的一些小知识

 2010-06-22 19:53:00 来源:WEB开发网   
核心提示:if(converter->;PrepareToConvertToOrFromL(KCharacterSetIdentifierUtf8,CEikonEnv:l:Static()->FsSession())!=CCnvCharacterSetConverter::EAvailable)User:eave(K

if(converter->;PrepareToConvertToOrFromL(KCharacterSetIdentifierUtf8,

CEikonEnv:l:Static()->FsSession())!=CCnvCharacterSetConverter::EAvailable)

User:eave(KErrNotSupported);

TInt state=CCnvCharacterSetConverter::KStateDefault;

HBufC* aTextBuf = HBufC::NewL( aStuffData.Length() );

TPtr16 ptr = aTextBuf->Des();

if(CCnvCharacterSetConverter::EErrorIllFormedInput == converter->ConvertToUnicode(ptr, aStuffData, state))

User:leave(KErrArgument); //Leave if error in conversion.

CleanupStack:popAndDestroy(); //clean for converter

复制代码

文件保存

一些数据保存到文件中去,每个变量都保存在记事本文件中的一行,每一行记忆个变量的值。

RFile file;

// open the file here ...

TFileText txtfile;

txtfile.Set(file);

// convert your data to a descripter ...

// this operation appends a line delimiter to the descriptor

txtfile.Write(data);

// Of cource TFileText::Read() is the reverse operation which read a whole line.

复制代码

编辑框的当前输入法

当焦点在某个编辑框时,获得当前编辑框的输入法:

TCoeInputCapabilities icap = edwin->InputCapabilities();

CAknEdwinState* edwinState = static_cast(icap.FepAwareTextEditor()->Extension1()->State(KNullUid));

TInt inputMode = edwinState->CurrentInputMode();

实现字节对齐

The GCC compiler ignores "#pragma pack" statement when compiling for ARM platform, so you should use "__attribute__((packed, aligned))", like this:

#if defined(__WINS__)

#define PACKED

#else

#define PACKED __attribute__((packed, aligned(1)))

#endif

#pragma pack(1)

typedef struct {

char sig[104];

unsigned char verl,key;

int nFile, dFile, crc;

上一页  1 2 3 4  下一页

Tags:Symbian 开发 一些

编辑录入:coldstar [复制链接] [打 印]
赞助商链接