read()
Purpose
Read from a file
Description
Read a string of text from a file from the current position the specified number of characters
Syntax
result = read( handle, count )
Arguments
handle handle of the file
count number of characters to read
result resulting text string
Example
string = "Hello World"
printAt( 0, 0, "Open file" )
handle = open()
printAt( 0, 1, "Write to file: ", string )
write( handle, string )
printAt( 0, 2, "Close file" )
close( handle )
printAt( 0, 3, "Open file" )
handle = open()
message = read( handle, 11 )
printAt( 0, 4, "Read from file: ", message )
printAt( 0, 5, "Seek to position 6" )
seek( handle, 6 )
message = read( handle, 5 )
printAt( 0, 6, "Read from file: ", message )
printAt( 0, 7, "Close file" )
update()
close( handle )
for i = 1 to 500 loop
update()
repeat
Associated Commands