×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    75

    Converting a string to a descriptor

    Hi All, I have a global function which takes a string as parameter. I need to convert this to a descriptor and display that has a message in information note. Here is the code i m using for it, but it throws error while compiling i.e str.Copy() does not match .
    TInt DummyFunction(const char *a )
    {
    TBuf8<256> str;
    str.Copy(*a);

    CAknInformationNote* informationNote;

    informationNote = new ( ELeave ) CAknInformationNote;

    // Show the information Note with
    // textResource loaded with StringLoader.
    informationNote->ExecuteLD(str);

    //
    // add your code here
    //
    return 0;
    }

    Calling this function in a class, ::DummyFunction("hello");


    BR,
    Saritha

  2. #2
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: Converting a string to a descriptor

    Check out the wiki.

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    444

    Re: Converting a string to a descriptor

    Hi,

    Modify your function defination as below:
    Code:
    TInt DummyFunction(const TDesC &aData )
    {
    //TBuf8<256> str;
    //str.Copy(*a);
    
    CAknInformationNote* informationNote;
    
    informationNote = new ( ELeave ) CAknInformationNote;
    
    // Show the information Note with
    // textResource loaded with StringLoader.
    informationNote->ExecuteLD(aData);
    
    //
    // add your code here
    //
    return 0;
    }
    And also DummyFunction(_L("hello")); will work.

    BR.
    Kavit.

  4. #4
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    75

    Re: Converting a string to a descriptor

    Hi kavit, the function takes const char* parameter and that i need to convert to a descriptor and pass that to the information note.
    How to convert that string to descriptor.


    BR,
    Saritha

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    444

    Re: Converting a string to a descriptor


  6. #6
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    75

    Re: Converting a string to a descriptor

    Hi Kavit, thanks a lot.I could able to do it now.

    BR,
    Saritha

Similar Threads

  1. hot append the string using descriptor
    By ganngadhar in forum Symbian
    Replies: 14
    Last Post: 2007-04-10, 06:04
  2. Converting audio from file to descriptor.
    By shoma1508 in forum Symbian
    Replies: 1
    Last Post: 2004-06-22, 11:37
  3. Converting a char* string to TPtrC datatype
    By sujoydas in forum Symbian
    Replies: 8
    Last Post: 2004-04-08, 09:44
  4. Problem converting from string to Int
    By Blkangel in forum Symbian
    Replies: 1
    Last Post: 2003-08-18, 16:48
  5. D211 new linux driver 1.04 not working !!
    By franz_meyer in forum Multimodecards
    Replies: 1
    Last Post: 2002-12-12, 08:31

Posting Permissions

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