Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Using TResourceReader


Example of using ReadTPtrC()

Consider a resource constructed from the following definition.

RESOURCE ARRAY anarray
{
items=
    {
    LBUF { txt="Esc"; },
    LBUF { txt="Enter"; },
    LBUF { txt="Tab"; },
    LBUF { txt="Del"; },
    LBUF { txt="Space"; }
    };
}

A TPtrC representing the second item can be constructed using the ReadTPtrC() function. The example simply takes the length of the text Enter:

// open the resource file
...
HBufC8* res = resourceFile.AllocReadLC(ANARRAY);
TResourceReader theReader;
...
TInt len;
len = (theReader.ReadTPtrC(1,res)).Length(); // len == 5
...