opens a file for reading or writing
INCLUDE 'iolib.h' openmodify(file,"filename")
openmodify(Handle,FileName) (i,i) (o,i)
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
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.
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.
No runtime errors. Fails if file could not be opened.
prolog-process, client-server, object
closefile , openread , openwrite , readdevice , writedevice , read , write