readdevice

BAP Online Manuals : Library Reference : Library by Name : readdevice
Previous: readchar
Next: readln

6.2.103. readdevice

sets or returns the current input stream

SYNOPSIS

INCLUDE 'iolib.h'
readdevice(file)

SYNTAX

readdevice(Handle) (i)

ARGUMENTS

handle(Handle) (i) Handle of file to be set

DESCRIPTION

Sets the current input stream to the source associated with Handle. Handle has to be obtained or initialised by a call to either openread , openmodify , or makewindow , or must be one of the predefined file handles stdin or keyboard. If handle is unbound, the handle of the current input stream is returned.

EXAMPLE

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

ERRORS

A runtime error occurs if the handle is invalid.

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

openread , openmodify , read , readchar , readln , get , see


BAP Online Manuals : Library Reference : Library by Name : readdevice
Previous: readchar
Next: readln