Skip to content
Tristan Hume edited this page Apr 23, 2012 · 2 revisions

#tell

##Syntax An tellStatement is:

tell : fileNumber , filePositionVar

##Description The tell statement sets filePositionVar, whose type must be int, to the current offset in bytes from the beginning of the specified file. The fileNumber must specify a file that is open with seek capability (or else a program argument file that is implicitly opened). The tell statement is useful for recording the file position of a certain piece of data for later access using seek.

##Example This example shows how to use tell to record the location of a record in a file. This location is later used by seek to allow the record to be read.

    var employeeRecord :
        record
            name : string ( 30 )
            pay : int
            dept : 0 .. 9
        end record
    var fileNo : int
    var location : int
    open : fileNo, "payroll", write, seek
    �
    tell : fileNo, location         % Make note of this location
    write : fileNo, employeeRecord  % Write record at this location
    �
    seek : fileNo, location     % Go back to location
    read : fileNo, employeeRecord   % Read the record
                        % that was previously written

##See also the read.html, write.html, open.html, close.html, seek.html, get.html and put.html statements.

Clone this wiki locally