13.07.2015 Views

Turbo Basic

Turbo Basic

Turbo Basic

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

RSET statementFunctionSyntaxRemarksSee AlsoExampleRSET moves string data into the random file buffer.RSET field variable = string expressionRSET and LSET both move string data into "field variables" thathave been defined in a previous FIELD statement as belonging tothe buffer of a random file.If the length of string expression is less than the size of fieldvariable specified in a FIELD statement, RSET right-justifies thisfield by padding it with spaces. This means that spaces are insertedbefore the first character of string expression so that after the. RS ET .operation LEN(field variable) still equals the width defined in. theassociated FIELD statement.LSET does left-justification with space padding (spaces areappended after the last character of string expression).RSET can also be used toformat output to the screen or printer:a$ = space$(20)RSET a$ = "Right-just"PRINT a$LSETOPEN "RSET.DTA" AS #1 LEN =18, define files' field names and sizesFIELD 1,2 AS FileInt$, 4 AS FileLong$,_4 AS FileSngl$, 8 AS FileDbl$, assign some values to the fields and, write the record to the random access fileFOR Count% = 1 TO 5RSET FileInt$ = MKI$(Count%)RSET FileLong$ = MKL$(Count%~2)RSET FileSngl$ = MKS$(Count%~2.1)RSET FileDbl$ = MKD$(Count%~4.4)PUT I,Count%NEXT Count%CLOSE 1END, close the file, end main program330<strong>Turbo</strong> <strong>Basic</strong> Owner's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!