home *** CD-ROM | disk | FTP | other *** search
- 'Reference Manual Example, Page 122.
- '
- '*************************************************************
-
- $LIB ALL OFF
- $ERROR ALL OFF
- CLS
-
- 'open a random-access file
- OPEN "R", #1,"CVISLD.DTA",18
- 'make two field defintions for each field
- FIELD #1, 2 AS IntegerVar$, 4 AS LongIntVar$,_
- 4 AS SinglePreVar$, 8 AS DoublePreVar$
- FIELD #1, 2 AS A$, 4 AS B$, 4 AS C$, 8 AS D$
- MaxInt% = 32767
- 'write some data to the file
- FOR I% = 1 TO 5
- 'convert the data and assign it to the
- 'buffer before writing it to the data file
- LSET IntegerVar$ = MKI$(I%)
- LSET LongIntVar$ = MKL$(I% + CLNG(MaxInt%))
- LSET SinglePreVar$ = MKS$(I% * CSNG(MaxInt%))
- LSET DoublePreVar$ = MKD$(MaxInt%^I%)
- PUT #1,I%
- NEXT I%
- FOR I% = 1 TO 5 'read data from file
- GET #1, I% 'display it onscreen
- PRINT CVI(A$); CVL(B$); CVS(C$); CVD(D$)
- NEXT I%
- CLOSE #1 'close the file
- END 'end the program