File Statements

OpenTuring

File Statements

File Commands

 open open a file
 close close a file
 put write alphanumeric text to a file
 get read alphanumeric text from a file
 write binary write to a file
 read binary read from a file
 seek move to a specified position in a file
 tell report the current file position
 eof check for end of file

File Command Syntax

open : streamNo, fileName, ioCapability {, ioCapability }
 ioCapability is one of get, put, read, write, seek, mod
  put or write capability will cause any existing file to be truncated to zero length unless the mod capability is also specified.
  seek capability is needed to use seek or tell commands.

close : streamNo
get : streamNo , getItem { , getItem }
put : streamNo , putItem { , putItem }
read : streamNo [ : fileStatus ] , readItem { , readItem }
write : streamNo[ : fileStatus ] , writeItem {, writeItem }
seek : streamNo , filePosition or seek : streamNo , *
tell : streamNo , filePositionVar
eof ( streamNo ) : boolean (This is a function)

Appending to a Text File

% Open the file for put, but do not erase it
open : streamNo, fileName, put { , get }, mod
% Move the file pointer to the end of the file
seek : streamNo, *