openmodify

BAP Online Manuals : Library Reference : Library by Name : openmodify
Previous: op
Next: openread

6.2.92. openmodify

opens a file for reading or writing

SYNOPSIS

INCLUDE 'iolib.h'
openmodify(file,"filename")

SYNTAX

openmodify(Handle,FileName) (i,i) (o,i)

ARGUMENTS

handle(Handle) (i) virtual file handled which will be associated with the file
void(Handle) (o) real file handle returned by the host
string(FileName) (i) name of the file to be opened

DESCRIPTION

The file with the name FileName is opened for reading and writing. It is referred to by the Handle, which may either be virtual or real.

EXAMPLE

file_str("test","Hello World"),
openmodify(f,"test"),
readdevice(f), writedevice(f),
readln(X),
filepos(f,6),
write("Guys !"),
readdevice(keyboard), writedevice(screen),
closefile(f),
file_str("test",Y),
write(X),nl,
write(Y),nl.

ERRORS

No runtime errors. Fails if file could not be opened.

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

closefile , openread , openwrite , readdevice , writedevice , read , write


BAP Online Manuals : Library Reference : Library by Name : openmodify
Previous: op
Next: openread