GETDATA

Top  Previous  Next

Syntax

GETDATA(blockname as DATABLOCK BYREF,var as ANYTYPE)

Description

Reads a datum from the indicated data block and increments the data pointer.

Parameters

blockname - Name of the data block specified in the DATABEGIN statement

var - Variable to store the datum into.

Return value

None

Remarks

It is possible to read past the end of data so a count should be kept or the last datum used as a terminator. Currently EBASIC supports INT, FLOAT, DOUBLE and STRING data items. GETDATA will convert between most common variable types. Reset the data pointer for the block by using RESTORE.

See Also: DATABEGIN, DATAEND, DATA, RESTORE

Example usage

DEF a as INT
 
RESTORE mydata
 
FOR x = 1 to 6
   GETDATA mydata,a
PRINT a
NEXT x
 
DO:UNTIL INKEY$ <> ""
END
 
DATABEGIN mydata
DATA 1,2,3
DATA 4,10,2002
DATAEND