×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    40

    Exclamation store buffer contents in string

    how to store contents of a buffer in string

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

    Re: store buffer contents in string

    What do you actually mean by that ? What is your buffer and what kind-of string you are using ?

    yucca

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

    Re: store buffer contents in string

    im using drawtext function for displaying contents of a buffer but drawtext function requires the a string input which wud b displayed so i think i need to store the buffer contents in a string and then give taht string as an input parameter
    i dnt knw wat aim doing is correct or not if there is any other way of doing it plz tell me
    thnx

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: store buffer contents in string

    Ok, GC Draw functions usually take unicode buffers as arguments, thus you could maybe use TBuf type of variable and copy the text into it and then using the draw text passing the TBuf into it.

    yucca

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

    Re: store buffer contents in string

    yes i knw but how can i copy from buffer in tbuf type variable?

  6. #6
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: store buffer contents in string

    maybe you could have a look into the SDK documentations, all things are classes, thus they have defined functions associated with them, and you can use these functions to work with the instances of these classes. SDK help documentation propably has quite much stuff on the classes involved, thus have a look into there.

    yucca

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

    Re: store buffer contents in string

    Quote Originally Posted by hm36
    yes i knw but how can i copy from buffer in tbuf type variable?
    What kind of "buffer" have you got?

  8. #8
    Registered User
    Join Date
    May 2007
    Posts
    40

    Re: store buffer contents in string

    RBuf8 type buffer

  9. #9
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: store buffer contents in string

    Your original question is so vague - how would you like it if our answers were equally vague such as "you can convert a buffer to a string by creating a temporary class and calling one of its functions". Not very helpful is it?
    Eventually we've found out you have an RBuf8, but what about the function arguments?


    If this function takes a const TDesC& then you need to convert from a narrow string to a wide string, this can be done using a temporary wide descriptor and calling its Copy() function, or you can use Expand() if the max length of the RBuf8 is long enough to allow for this.

    For example

    RBuf8 buf;
    ...
    fill buf
    .....
    Function(buf.Expand());

    Expand doubles the length, so you have to make use the RBuf8 is large enough before calling Expand(), if its not large enough an RBuf8 can be made larger by using its ReAllocL() function.
    Last edited by hotcheese; 2007-07-06 at 21:03.

  10. #10
    Registered User
    Join Date
    May 2007
    Posts
    40

    Re: store buffer contents in string

    here is my code :
    { RBuf8 urlBuf;
    const int MAX_SEARCH_STRING_LENGTH = 100;
    TBuf<MAX_SEARCH_STRING_LENGTH> searchString;
    RunDataQuery1L( searchString,ETrue,NULL );
    _LIT8(SEARCH_URL,"http://www.yahoo.com/");
    urlBuf.CreateL(512);
    urlBuf.CleanupClosePushL();
    urlBuf.Format(SEARCH_URL,NULL);
    IssueHTTPGetL(&urlBuf);
    CleanupStack::PopAndDestroy();
    return ETrue;}
    im still confused dnt know how to handle this RBuf8 , plz help

  11. #11
    Registered User
    Join Date
    May 2007
    Posts
    40

    Unhappy Re: store buffer contents in string

    im tryint to display contents of the ulrBuf through

    gc.DrawText(*urlBuf,drawRect,baselineOffset,CGraphicsContext::ECenter, 0);

    but i get an error saying "a pointer/array type was expected here "
    what shud i do im clueless

  12. #12
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: store buffer contents in string

    urlBuf is an object. Objects cannot be dereferenced, thus *urlBuf makes no sense, that is what the error message tells.
    However urlBuf remains to be a 8-bit descriptor, while DrawText expects a 16-bit one.
    Have you tried what Hotcheese has suggested? ("Function" is DrawText in your case)

  13. #13
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: store buffer contents in string

    Quote Originally Posted by hm36
    here is my code :
    { RBuf8 urlBuf;
    const int MAX_SEARCH_STRING_LENGTH = 100;
    TBuf<MAX_SEARCH_STRING_LENGTH> searchString;
    RunDataQuery1L( searchString,ETrue,NULL );
    _LIT8(SEARCH_URL,"http://www.yahoo.com/");
    urlBuf.CreateL(512);
    urlBuf.CleanupClosePushL();
    urlBuf.Format(SEARCH_URL,NULL);
    IssueHTTPGetL(&urlBuf);
    CleanupStack::PopAndDestroy();
    return ETrue;}
    im still confused dnt know how to handle this RBuf8 , plz help

    You still have not told us what the parameters to DrawText() are yet despite being asked. I guessed that it takes a const TDesC& but you haven't confirmed, if that's the case then I've shown you the answer about how to convert an RBuf8 to a const TDesC&.

    However how does the above code make a call to
    gc.DrawText(*urlBuf,drawRect,baselineOffset,CGraphicsContext::ECenter)?

Similar Threads

  1. reading and writing buffer contents
    By hm36 in forum Symbian C++
    Replies: 0
    Last Post: 2007-06-29, 14:15
  2. CMdaAudioOutputStream Not working with EXEDLL target
    By fnagaton in forum Symbian C++
    Replies: 6
    Last Post: 2005-10-03, 05:51
  3. Dialog's clipping area (again). Nokia experts, please help
    By synov in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-06-26, 14:35
  4. D211 new linux driver 1.04 not working !!
    By franz_meyer in forum Multimodecards
    Replies: 1
    Last Post: 2002-12-12, 08:31
  5. SMS Msg using VB Application
    By gurup83 in forum General Messaging
    Replies: 2
    Last Post: 2002-07-11, 04:48

Posting Permissions

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