Hi all,

I wonder whether anybody out there has come across the same 
problem I have, (and has found a solution).


Basically, what I would like is to be able to re-dimension an array within 
a subroutine (proc/fn) BY PASSING THE SUBROUTINE THE ARRAY 
AS A PARAMETER.

For example, I have an array f$ (10,10) and a variable 'mycount%' 
which contains the last element of the array that is filled in.

>From time to time, a new element of the array must be fileld in, and 
mycount% makes sure that I use an, up to now, unused element of the 
array for that - and also that I don't go over the top of the array.
Since I do that with several arrays, whenever I fill in an element in the 
array, I'd like to use some sort of procedure, which could be as follows:

def proc check_array(array$,count%,new_string_to_add$)
local a%,b%,temp_array$
  a%=dimn(array$,1)
  if count%<a%
     array$(count%)=new_string_to_add$
     count%=count%+1
  else
    [copy array to temp array]
    b%=dimn(array$,2)
    DIM array$(count%+100,b%)
    [copy array back from temp array]
    [set new element, as above]
  endif
end def 

and for the above example  the procedure would be called with
check_array f$,mycount%,"whatever"

However,  that doesn't work, as the line "  DIM 
array$(count%+100,b%)" will generate an error - you cannot 
redimension an array passed as a parameter.

Any ideas?

Thanks in advance

Wolfgang

Reply via email to