StrExpr may be any string expression, but only the first 2, 4, or 8 bytes are used by cvi, cvs, and cvd, respectively.
defint n defsng a print "writing..." open "cvt.out" as #1 len = 6 field #1, 2 as no$, 4 as amt$ no = 1 while no input "Enter chk #, amt (or 0,0 when done)"; no, amt 40 lset no$ = mki$(no) 50 lset amt$ = mks$(amt) put #1 wend close #1 print "reading..." open "cvt.out" as #1 len = 6 100 field #1, 2 as no$, 4 as amt$ no = 1 while no 110 get #1 120 no = cvi(no$) 130 amt = cvs(amt$) if no then print using "##### $$#,###.##"; no, amt wend close #1This example uses a random file (#1) which has fields defined as in line 100. Line 110 reads a record from the file. Line 120 uses the cvi function to interpret the first two bytes (no$) of the record as an integer; no$ was originally a number which was written to the file using the mki$ function in line 40. Line 130 uses the cvs function to interpret the first four bytes (amt$) of the record as a single-precision number; amt$ was originally a number which was written to the file using the mks$ function in line 50.
from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber