Arrays (was Re: opendir() - Is there a filename cap ?)

Kenneth Brody kenbrody at bestweb.net
Sat Nov 12 10:57:58 PST 2005


Quoting Bob Stockler (Sat, 12 Nov 2005 13:04:21 -0500):

> Ken Brody wrote (on Sat, Nov 12, 2005 at 12:32:58PM -0500):
>
> | Quoting Fairlight (Sat, 12 Nov 2005 06:23:14 -0500):
[...]
> | > Is that a special array to fP?  Because fP's arrays in general are
> | > documented to being a maximum of 999 elements, are they not?  (Last
> | > time I checked with an fP developer, I was told they were.)
> |
> | It's 32767, not 999.
>
> So @DIRLIST[] could have 32768 elements since, unlike arrays
> _we_ can dimension, these arrays maintained by filePro all
> begin with an element "0" ?

The arrays you can define can also go to 32767, as the code I posted
shows.  System arrays have a special subscript zero, which will tell
you how many elements are currently in the array.

So, @DIRLIST["0"] will tell you how many filenames were returned.  Of
course, in this case, it's the same as the return value from OPENDIR().
But other system arrays may not have an easy way of knowing how many
elements are in them.  For example, @FPFILES[] contains a list of all
open filePro files.  Because you may have opened and the closed some
files, there may be null entries within the list, so a null value does
not mean "end of list".

System arrays also will not fail if you access a subscript out of
range.  Instead, a null string will be returned.

You can also use system arrays as parameters to functions which take
"regular" arrays.  For example:

    xx = listbox(@UNAME)

[...]
> | ::end:
> | ::dim bigarray[32767](6,.0):
> | @entsel::show "\{T}-Test bigarray":
> | ::end:
> | @keyT::xx(6,.0) = "1" ; sz(6,.0) = "32767":
> | loop:xx le sz:bigarray[xx] = xx ; xx = xx + "1" ; goto loop:
> | ::xx = "1":
> | loop2:mod(xx,"1000") = "0":show popup xx & bigarray[xx] ; video sync:
> | :xx ne bigarray[xx]:errorbox xx < "is not" < bigarray[xx] ; end:
> | :xx lt sz:xx = xx + "1" ; goto loop2:
> | ::clears:
> | ::end:

--
KenBrody at BestWeb dot net        spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com


More information about the Filepro-list mailing list