×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    23

    Arrow StringLoader::LoadLC Problem

    Hi friends

    I need to pass a dynamic value during runtime in StringLoader::LoadLC();
    When i use a static variable like

    TInt getText = R_COMMAND1_TEXT;

    and pass to

    HBufC* textValue = StringLoader::LoadLC(getText );

    Then its working fine.I can get the value.

    But my problem is, i need to pass a value which i get it in TBuf variable.
    I tried to convert the TBuf to TInt and tried to pass the value.
    But the application get crashed.

    Can any one please help me to solve this problem.
    The code i tried is ...

    _LIT(KgetText,"R_COMMAND1_TEXT;");
    TBuf16<50> To_Print1(KgetText);
    TInt ddd;
    TLex iLex2(To_Print1);
    iLex2.Val(ddd);
    HBufC* textValue = StringLoader::LoadLC(ddd);

    Wats the problem in this .....

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: StringLoader::LoadLC Problem

    could you explain what is the purpose of this ?

    R_COMMAND1_TEXT is mapped to a interger that defines the resource, thus you need to use it as interger directly as with the working sample code you showed.

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    23

    Re: StringLoader::LoadLC Problem

    Hi

    My purpose is to get the value from a .rss file where i have stored as a resource.

    During runtime i need to get the resource value.

    I have value in a TBuf variable. According to the value i need to retrieve the value from the resource.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,697

    Re: StringLoader::LoadLC Problem

    May I ask what "value" you need?
    R_COMMAND1_TEXT is a number, #define-d in your .rsg file, that is a value.
    textValue is a buffer, loaded from your resource file, that is an other value.
    And there is no 3rd "value" I can imagine.
    Code:
    TInt ddd=R_COMMAND1_TEXT;
    is what you are looking for?

  5. #5
    Registered User
    Join Date
    May 2007
    Posts
    23

    Re: StringLoader::LoadLC Problem

    so then how can i get the resource value in runtime ?

    Is there some other way so that i can get the resource value using a TBuf variable apart from TInt ?

  6. #6
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: StringLoader::LoadLC Problem

    This should also be a lesson in checking return code for errors.
    No doubt iLex2.Val(ddd) is failing and you are not checking it.

    But as Wizard says, if you look up the definition of R_COMMAND1_TEXT in the RSG file you will see that it is just a #define to a number already.
    Download Symbian OS now! [url]http://developer.symbian.org[/url]

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,697

    Re: StringLoader::LoadLC Problem

    The string "R_COMMAND1_TEXT" is not present in your running application by default. If you need recognizing it in runtime, you have to provide your own converter-method (a series of if-s for example). I still can not see the point anyway.

Similar Threads

  1. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. WAP service problem on Apache
    By bigg_o in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-04-17, 16:05
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

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