SecondBASIC Documentation v3

Home / Command Reference / Read, ReadInt, ReadLong

Randomize

Description: Reads data from Data, DataInt, and DataLong statements.

Syntax:

Read <Variable> [, <Variable> [, n]]
ReadInt <Variable> [, <Variable> [, n]]
ReadLong <Variable> [, <Variable> [, n]]

Part Description
<Variable> Required. Reads the data into the variable. If <Variable> is an integer, the data will be read and the most significant byte will be set to 0. If <Variable> is a string, then the data will be copied into a string one byte after another until a null (0) is reached.

Note: Only integers can be used with ReadInt and only longs can be used with ReadLong.

Example:

        Reload MyData
        For i = 0 To 1
                Read b$
                Print b$
        Next
 
        Reload MyDataInt
        For i = 0 To 3
                ReadInt a
                Print a
        Next
        Reload MyDataLong
 
        For i = 0 To 2
                ReadLong b&
                Print b&()
        Next
 
MyData:
        Data "Hello World!", "More Data"
MyDataInt:
        DataInt 0,1,$0EAA, &hFF
MyDataLong:
        DataLong 80000,95000,8975200