×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    47

    problem about Reading data from a RESOURCE FILE to an application

    Dear all

    I have met a problem during reading data from a resource file. I have refered to the default example code (base\readdata), but I got a "program close" error in my emulator

    the following the part of my code for reading data
    **********************************************
    RResourceFile resourceFile;
    RFs fsSession;
    fsSession.Connect();

    resourceFile.OpenL( fsSession, _L ("C:\\system\\apps\\owm\\owm.rsc") );

    resourceFile.ConfirmSignatureL(0);

    HBufC8* res = resourceFile.AllocReadLC(CDA);
    iLog->Log(_L("dddd"));

    delete res;
    resourceFile.Close();
    fsSession.Close();
    iLog->LogNewline();

    **********************************************

    I know that i have to call ConfirmSignature() before calling AllocReadLC(), but I still get the error. I can log the string "dddd" so it means i got the error after calling the AllocReadLC or probably later

    So anyone knows what's going on????
    Help~~~~~
    thx a lot

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Beijing
    Posts
    3,609
    Use the following method to do it:

    RConeResourceLoader loader;
    _LIT(KDllResFileName, "z:\\system\\data\\xxx.rsc");
    TFileName fileName;
    fileName.Copy(KDllResFileName);
    loader.OpenL(fileName);

    Hope this helps!

    Liuxg
    Forum Nokia

  3. #3
    Registered User
    Join Date
    Apr 2004
    Posts
    47
    by the way, how to access those RESOURCE data via the loader?
    thx

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Beijing
    Posts
    3,609
    Once the resource is loaded, you can just use it directly as normal. It works the same as the ones defined in your currentl .rss file. Please try it. Should you have any problems, please let me know.

    Best regards,

    Liuxg
    Forum Nokia

  5. #5
    Registered User
    Join Date
    Apr 2004
    Posts
    47
    another question here...

    i failed to get the correct data from my resource file
    i have succeeded in loading the RSC file, then i tried to access the data by TResourceReader (just as the example from the SDK)

    i tried this

    theReader.ReadInt32() (nb sth like this, to get a LONG)

    and

    theReader.ReadHufC8 (nb still sth like this, to get a LTEXT)

    but i have got some strange things...but not my data defined in the RESOURCE file....

    my resource file is like this
    RESOURCE ARRAY cda
    {
    datament = {
    DATA{
    longNum = 8;
    ltextString = "ABC";
    },
    ..............

    };
    }

  6. #6
    Registered User
    Join Date
    Apr 2004
    Posts
    47
    "It works the same as the ones defined in your currentl .rss file"

    i don't understand what u mean in this statement quite much...

    so i can create a TResourceReader after creating the RConeResourceLoader, and then access the data via the Reader as normal?

    or i don't need to create a Reader at all but to access the data via the Loader directly??

    besides would u mind to give me a sample code?

    thx a lot~~

  7. #7
    Registered User
    Join Date
    Apr 2004
    Posts
    47
    I have solved the problem, thx very much

  8. #8
    Registered User
    Join Date
    Apr 2004
    Posts
    14
    hi

    I'm also trying to read an array from the resource file. I need it for getting the text selected from a CAknEnumeratedTextPopupSettingItem. Can you show me your solution?

    thanks
    M醨io Afonso

  9. #9
    Registered User
    Join Date
    Apr 2004
    Posts
    47
    sorry for that i reply u so late
    do u still need my help now?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×