Announcement

Collapse
No announcement yet.

String Ptr members in UDT's

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

  • Scott Hauser
    replied
    Hi Mike
    Another way to skin the cat is (your code modified)

    Code:
    #COMPILE EXE
     #DIM ALL
     #REGISTER NONE
    
     TYPE test
          l AS LONG
          sPtr AS DWORD
     END TYPE
    
     FUNCTION PBMAIN()
        DIM t AS TEST, A$
        DIM x AS ASCIIZ PTR
        t.l = 2
        A$ = "TEST"
        t.sPtr = STRPTR(A$)
        x = t.sPtr
        MSGBOX @x
     END FUNCTION
    I've used this in the past where I wanted a scratch UDT that could be used differently in
    different procedures.

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

    Leave a comment:


  • Mike Joseph
    replied
    after a bit more searching i came across the thread at
    http://www.powerbasic.com/support/pb...ead.php?t=2357

    which answers my question. so nevermind
    -mike

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

    Leave a comment:


  • Mike Joseph
    started a topic String Ptr members in UDT's

    String Ptr members in UDT's

    Hi, I was under the impression that the following would work, but i get a page fault every time i run it.

    Code:
    #COMPILE EXE
    #DIM ALL
    #REGISTER NONE
    
    TYPE test
         l AS LONG
         sPtr AS STRING PTR
    END TYPE
    
    FUNCTION PBMAIN()
       DIM t AS TEST
       
       t.l = 2
       [email protected] = "Test"
       
    END FUNCTION
    Is there no way to use variable length strings in a UDT?

    -Mike


    ------------------
Working...
X