This requires a basic understanding of dimensioned arrays versyus a dynamic
array. A dimensioned array is a collection of string and/or variables
whereas a dynamic array is a single string variable with some convenient
delimiters that functions have been built around.

Once a 'variable' has been created as the result of an OPEN TO statement
it's not available in the debugger and is therefore committed to being a
file variable throughout its life. It can be re-used as a file or string
variable. Hence, you could do the following safely although not
recommendedly (?):

DIM X(10) ; MAT X=""
OPEN FILE1 TO X(1)...
OPEN FILE2 TO X(2)...
OPEN FILE3 TO X(1)...
X(2)="BOB"
PRINT "ENTER YOUR NAME ":;INPUT X(4)
X(5)="FRED"
READ X(6) FROM X(1), X(5) ELSE STOP
PRINT X(6):" ":X(2):" ":X(5)

You shouldn't worry about exceeding the maximum 'variable' count as I'm sure
it's much higher than the 1,500 that plagued me once in 1984. Thus, you
could DIM FILES(300) if you should ever need that many.

My 1 cent.

----- Original Message -----
From: "Barry Brevik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 12, 2004 8:00 PM
Subject: [U2] [UV] File handles in arrays


> Is it not possible to store a file handle in a dynamic array?
>
> This seems to work:
>
> DIM FILE.HANDLES(10)
> OPEN '','PARTS' TO FILE.HANDLES(1) ELSE PRINT 'noopen'
> READ THIS.REC FROM FILE.HANDLES(1), '1900-90' ELSE PRINT 'noread'
>
> ...but I'd rather use dynamic arrays.
> -------
> u2-users mailing list
> [EMAIL PROTECTED]
> http://www.u2ug.org/listinfo/u2-users
-------
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users

Reply via email to