(again) ways to dim from an array pointer?

Everything else that doesn't fall into one of the other PB categories.
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

(again) ways to dim from an array pointer?

Post by dagcrack »

I have a pointer of an array which is already full of yummy data, however, I have a procedure which requires an array pointer to be passed, thats no problem, but as I want to change some entries of the array inside this procedure, I should re-dim it.. but however, if I do that, the new array will be empty. is it possible to "fill" an empty array (of the same size of coursex) if I have the pointer of an already filled of data array ?

I just find PB very limitating when it comes to arrays and as I never seen this done, I came, I asked, I drank a beer.


:? Any ex guru (now enthusiast?) got a clue of how to achive this? is it even possible in pb 3.93?.

Please.. dont say "4.0 will support this, just wait" because thats a little sad ;) .. A little mind-repressing as well!.



Cheers!
Will give out free beer if someone suggests a solution


:lol:
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

Well.. I dont really need this anymore! But it would be nice to know if its possible, as I might need it soon (I needed this some time ago, you can see a thread I made here asking but go no solution that time).

However now its different..
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
Max.
Enthusiast
Enthusiast
Posts: 225
Joined: Fri Apr 25, 2003 8:39 pm

Post by Max. »

dagcrack wrote:Well.. I dont really need this anymore! But it would be nice to know if its possible, as I might need it soon (I needed this some time ago, you can see a thread I made here asking but go no solution that time).

However now its different..
Not sure if I understood the question. Do you mean something like this?

Code: Select all

; different sized arrays
Dim a.b(49)
Dim b.b(99)

;filling them with different data
For i= 0 To 49
  a(i)=i
Next i

For i=0 To 99
  b(i)=99-i
Next i

;test before copy
For i=0 To 49
  Debug Str(a(i))+" / "+Str(b(i))
Next i

;copy array a to array b
Result = CopyMemory(@a(0),@b(0),50)

;test after copy
Debug "---"
For i=0 To 49
  Debug Str(a(i))+" / "+Str(b(i))
Next i

For i=50 To 99
  Debug " / "+Str(b(i))
Next i
Athlon64 3800+ · 1 GB RAM · Radeon X800 XL · Win XP Prof/SP1+IE6.0/Firefox · PB 3.94/4.0
Intel Centrino 1.4 MHz · 1.5 GB RAM · Radeon 9000 Mobility · Win XP Prof/SP2+IE6.0/Firefox · PB 3.94/4.0
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

Not really.
Its not about different sized arrays, but I might write some pseudo code soon if no one understands the question :?
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
Max.
Enthusiast
Enthusiast
Posts: 225
Joined: Fri Apr 25, 2003 8:39 pm

Post by Max. »

dagcrack wrote:Not really.
Its not about different sized arrays, but I might write some pseudo code soon if no one understands the question :?
The different sizes were just used because you said "I should re-dim it".

The point is, you can use can get pointers to arrays and you can copy array data using CopyMemory.

Some pseude code could really help.
Athlon64 3800+ · 1 GB RAM · Radeon X800 XL · Win XP Prof/SP1+IE6.0/Firefox · PB 3.94/4.0
Intel Centrino 1.4 MHz · 1.5 GB RAM · Radeon 9000 Mobility · Win XP Prof/SP2+IE6.0/Firefox · PB 3.94/4.0
Post Reply