SUMMARY
Below is an example of defining a string array in multiple FIELD
statements invoked in a FOR ... NEXT loop.
Code Example
(Note: To run this program in GW-BASIC, you must add a line number to
each line.)
OPEN "test.dat" AS #1 LEN = 300
DIM F$(30)
i = 1
FOR j = 1 TO 10
FIELD #1, (j - 1) * 30 AS temp$, 10 AS F$(i), 10 AS F$(i + 1), 10 AS F$(i +
2)
i = i + 3
NEXT
LSET F$(30) = "1234567890"
LSET F$(15) = "ABCDEFGHIJ"
PUT #1, 1
CLOSE
OPEN "test.dat" AS #1 LEN = 300
i = 1
FOR j = 1 TO 10
FIELD #1, (j - 1) * 30 AS temp$, 10 AS F$(i), 10 AS F$(i + 1), 10 AS F$(i +
2)
i = i + 3
NEXT
GET #1, 1
PRINT F$(30), F$(15)
REFERENCES
For more information about alternatives to multiple FIELD statements
in the latest Microsoft BASIC products, query for a separate article
in this Knowledge Base using the following words:
Microsoft BASIC Professional Development System (PDS) versions 7.00
and 7.10 for MS-DOS and MS OS/2 introduce the ability to have arrays
in user-defined TYPEs, which allows you to write an array to disk all
at once. For more information, query for a separate article in this
Knowledge Base using the following words:
RANDOM and BINARY and PUT and Array and TYPE