home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY1 / EXAMP1.ZIP / RMEX122.BAS < prev    next >
BASIC Source File  |  1990-04-17  |  967b  |  32 lines

  1. 'Reference Manual Example, Page 122.
  2. '
  3. '*************************************************************
  4.  
  5. $LIB ALL OFF
  6. $ERROR ALL OFF
  7. CLS
  8.  
  9. 'open a random-access file
  10. OPEN "R", #1,"CVISLD.DTA",18
  11. 'make two field defintions for each field
  12. FIELD #1, 2 AS IntegerVar$,   4 AS LongIntVar$,_
  13.       4 AS SinglePreVar$, 8 AS DoublePreVar$
  14. FIELD #1, 2 AS A$, 4 AS B$, 4 AS C$, 8 AS D$
  15. MaxInt% = 32767
  16. 'write some data to the file
  17. FOR I% = 1 TO 5
  18.   'convert the data and assign it to the
  19.   'buffer before writing it to the data file
  20.   LSET IntegerVar$ = MKI$(I%)
  21.   LSET LongIntVar$ = MKL$(I% + CLNG(MaxInt%))
  22.   LSET SinglePreVar$ = MKS$(I% * CSNG(MaxInt%))
  23.   LSET DoublePreVar$ = MKD$(MaxInt%^I%)
  24.   PUT #1,I%
  25. NEXT I%
  26. FOR I% = 1 TO 5            'read data from file
  27.   GET #1, I%               'display it onscreen
  28.   PRINT CVI(A$); CVL(B$); CVS(C$); CVD(D$)
  29. NEXT I%
  30. CLOSE #1                   'close the file
  31. END                        'end the program
  32.