Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2005

    Create different TPtrs from a single HBufC

    Hi All,

    I'm creating a single buffer HBufC into which I need to create 3 different TPtr at different positions within the buffer, so as to save the overhead of creating 3 different HBufCs.
    Here's what I'm doing

    HBufC* buf=HBufC::NewLC(414);
    TPtr ptr1(buf->Left(76).Ptr(),76);
    TPtr ptr2(buf->Mid(68,68).Ptr(),68);
    TPtr ptr3(buf->Right(270).Ptr(),270);

    But when I try do that I receive
    function call 'TPtr16(const unsigned short*,int)' does not match 'TPtr16::TPtr16(unsigned short*,int).

    Why do I get this error even though the SDK says that parameter in the TPtr16 has to be const TUInt16*.
    Please help me as to where am I going wrong here?


  2. #2
    Regular Contributor
    Join Date
    Mar 2005
    TPtr ptr1((unsigned short*)(buf->Left(76).Ptr()),76);

    it works

Posting Permissions

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