BAP Online Manuals : Library Reference : Library by Name : read
Previous: random
Next: readchar

6.2.101. read

reads a term from the current input stream

SYNOPSIS

INCLUDE 'iolib.h'
read(InputTerm)

SYNTAX

readchar(Term) (o)

ARGUMENTS

void(Term) (o) term that was read

DESCRIPTION

Reads a term from the input stream and matches it with Term. The current operator declarations are used. The term must be followed by a dot and a newline character. Both are removed from the current input stream. Fails if no valid term is encountered or it does not match Term.
NOTE: In this version of BAP the dot is not required. This might change in future versions.

EXAMPLE

read(Expr),		% e.g. enter "3+5.", 
"4*6." 
Sum is Expr,
write(Sum),nl.

ERRORS

No runtime errors.

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

get , readln , readchar , readdevice


BAP Online Manuals : Library Reference : Library by Name : read
Previous: random
Next: readchar