QBasic 1.1: LSET Statement
Explanation
LSET, RSET Statements
LSET and RSET move data into a random-access file buffer (in preparation for a PUT statement) and left- or right-justify the value of a string variable. LSET also copies the contents of one record variable to another.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
LSET stringvariable$=stringexpression$ |
RSET stringvariable$=stringexpression$ |
LSET recordvariable1=recordvariable2 |
Description / Parameter(s)
stringvariable$ |
Any string variable or a random-access file field defined in a FIELD statement. |
stringexpression$ |
For LSET, the left-justified version of stringvariable$. For RSET, the right-justified version of stringvariable$. |
recordvariable1 recordvariable2 |
Record variables of any user-defined data type. Use LSET to assign a record variable of one data type to a different user-defined data type. |
Example
OPEN "FILEDAT.DAT" FOR RANDOM AS #1 LEN = 10
FIELD #1, 5 AS Ls1$, 5 AS Rs1$
LSET Ls1$ = "LSET"
RSET Rs1$ = "RSET"
PUT #1, 1
CLOSE #1
OPEN "FILEDAT.DAT" FOR RANDOM AS #1 LEN = 10
FIELD #1, 5 AS Ls2$, 5 AS Rs2$
GET #1, 1
PRINT "*" + Ls2$ + "*", "*" + Rs2$ + "*"
CLOSE #1