filepos

BAP Online Manuals : Library Reference : Library by Name : filepos
Previous: filedate
Next: filesize

6.2.52. filepos

sets or determines the current file position

SYNOPSIS

INCLUDE 'iolib.h'
filepos(Handle,X),
X1 is X + 20,
filepos(Handle,X1)

SYNTAX

filepos(Handle,Pos) (i,i) (i,o)

ARGUMENTS

handle(Handle)(i) handle of the file to be examined
integer(Pos) (i) position within the file where to move to
integer(Pos) (o) current position within the file

DESCRIPTION

The position within the file associated with Filehandle is either set or returned. Fails if a positions could not be set, e.g. if handle is bound to a window instead of a file on disk.

EXAMPLE

openread(file,"test"),
readdevice(file),
filepos(file,20),	% skip 20 first characters
readln(X),
readdevice(stdin),
closefile(file).

ERRORS

A runtime error if handle is not valid. Fails if Pos exceeds actual file size.

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

filesize , deletefile , openwrite , openread


BAP Online Manuals : Library Reference : Library by Name : filepos
Previous: filedate
Next: filesize