×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    May 2003
    Posts
    471

    Descriptor problem

    Hi All,

    I have a function that manipulates buffers:

    void foo (TDes8 & a_buffer1, TDes8 & a_buffer2 )

    How do I define the objects for that function???

    Thanks,
    Nahum

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Descriptor problem

    Strange question ... but if I got it right here's a possible answer:
    Code:
    TBuf8<30> oneBuffer;
    HBufC8* anotherBuffer = HBufC8::NewLC(30);
    
    ...
    TPtr8 ptr = anotherBuffer->Des();
    foo(oneBuffer, ptr);
    ...
    
    CleanupStack::PopAndDestroy(anotherBuffer);

  3. #3
    Regular Contributor
    Join Date
    May 2003
    Posts
    471

    Re: Descriptor problem

    Thanks ltomuta,

    You got it right but the code is not compiling:

    void foo ( TDes8 & a_buffer ) {}

    HBufC8 * buffer = HBufC8::NewL ( 16 ) ;

    foo ( buffer->Des() ) is not compiling. The compiler output is:
    function call '[TParser].foo(TPtr8)' does not match
    'TParser::foo(TDes8 &)' (non-static)

    Nahum

  4. #4
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Descriptor problem

    I think I've wrote
    Code:
    foo(/*oneBuffer,*/ ptr);
    and not
    Code:
    foo(anotherBuffer->Des());
    It isn't exactly the same thing ... Then, are you sure that you need HBufC rather than TBuf ? If so RBuf may be a better option if your SDK supports it.

  5. #5
    Regular Contributor
    Join Date
    May 2003
    Posts
    471

    Re: Descriptor problem

    Thanks,

    I don't care if it is HBuf or TBuf. All I need is:

    *** buffer;

    foo( TDes8 & a_buffer)

    and then to call:

    foo ( buffer ).

    What is *** ???

  6. #6
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Descriptor problem

    In C++ that can be anything derived from TDes8 so basically any modifiable (if needed) or unmodifiable (if method only reads data from it) 8 bit descriptor. It pretty much depends on what are you doing with the data stored inside.

  7. #7
    Regular Contributor
    Join Date
    May 2003
    Posts
    471

    Re: Descriptor problem

    Thanks!

    I got it finally

    Nahum

Posting Permissions

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