Announcement

Collapse
No announcement yet.

Porting C to PB - How do I cast a handle to a type?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Porting C to PB - How do I cast a handle to a type?

    All,

    I was wondering what the best method is for casting a handle to a type.
    In C, I have the following code:

    //MY_ENTITY is a C struct
    // m_lHandle is a C long
    MY_ENTITY* structEntity =((MY_ENTITY*)m_lHandle);

    Given I have a PB type MY_ENTITY_PB, what is the equivalent PB code?

    Thanks,

    Rich

    ------------------
    _____________________________________________________________________________________
    It's hard when you're up to your armpits in alligators to remember you came here to drain the swamp.
    President Reagan
    February 10, 1982

    [This message has been edited by Rich Brockway (edited February 20, 2003).]
    _____________________________________________________________________________________
    It's hard when you're up to your armpits in alligators to remember you came here to drain the swamp.
    President Reagan
    February 10, 1982

  • #2
    Code:
    LOCAL structEntity AS MY_ENTITY_PB PTR
    
    structEntity = m_lHandle
    (MY_ENTITY*) < denotes that is a pointer to that struct.

    Rosa


    ------------------

    Comment


    • #3
      Originally posted by Rosa Meltronco:
      Code:
      LOCAL structEntity AS MY_ENTITY_PB PTR
      
      structEntity = m_lHandle
      (MY_ENTITY*) < denotes that is a pointer to that struct.

      Rosa
      Rosa,

      I appreciated your help. It was not the C code that perplexed me. It was the translation to PB that had me wondering what was "legal" in this case.

      Thanks,

      Rich



      ------------------
      _____________________________________________________________________________________
      It's hard when you're up to your armpits in alligators to remember you came here to drain the swamp.
      President Reagan
      February 10, 1982
      _____________________________________________________________________________________
      It's hard when you're up to your armpits in alligators to remember you came here to drain the swamp.
      President Reagan
      February 10, 1982

      Comment

      Working...
      X