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

6.2.93. openread

opens a file for reading

SYNOPSIS

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

SYNTAX

openread(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 only. It is referred to by the Handle, which may either be virtual or real.

EXAMPLE

file_str("test","Hello World"),
openread(f,"test"),
readdevice(f),
readln(X),
readdevice(keyboard),
closefile(f),
write(X),nl.

ERRORS

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

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

closefile , openmodify , openwrite , readdevice , writedevice , read , write


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