Announcement

Collapse
No announcement yet.

Assigning a double word ptr to string data

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

  • Assigning a double word ptr to string data

    I'm attempting to assign a string's bytes to a double word array. Here's what I tried that doesn't work:

    Code:
               dim bc???(1 to lnw???)
    
               dim ptbc as dword ptr
               dim ptw as string ptr
    
               ptbc=varptr(bc???(1))
               ptw=strptr(w$)
    
               ptbc=ptw
    I know there is a way to do this, just can't remember how!
    Any ideas?
    Jim Seekamp

  • #2
    Jim,
    Code:
    ptbc=ptw
    just assigns the value of the pointer itself. You need to us @ to assign the thing being pointed to by the pointer.
    Paul.

    Comment


    • #3
      REDIM bc???(1 TO LEN(W$)\4 - (LEN(W$) MOD 4 <> 0 ) AT STRPTR (W$)

      Does not create a copy: Changes to W$ automatically change the values of the elements of bc???() (which just might be the behavior you are after?)

      Changes to length of W$ of course require REDIM, but that's true even when you DO copy the string bytes to the integer array.

      MCM
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Thanks Michael -
        That's exactly what I was looking for!
        Jim Seekamp

        Comment

        Working...
        X