new_handle

BAP Online Manuals : Library Reference : Library by Name : new_handle
Previous: mkdir
Next: nl

6.2.87. new_handle

associates a term with a virtual file handle

SYNOPSIS

INCLUDE 'msglib.h'
new_handle(object,data(test),user_object,"OPEN OBJECT")

SYNTAX

new_handle(VirtualHandle,Term,Type,ErrString) (i,i,i,i)

ARGUMENTS

handle(VirtualHandle) (i) handle that is associated with term
void(Term) (i) term that becomes 'value' of VirtualHandle
atom(Type) (i) type of the handle
string(ErrString) (i) error message printed in case of misuse

DESCRIPTION

Associates the VirtualHandle with the Term (e.g. real handle). Together with handle_value and rem_handle the user can use this to access his own data via virtual file handles. Type may be any atoms except the predefined types file,window,btop.
Please also consult the description of handle_value .

EXAMPLE

new_file(my_data,"Hello World",user_string,"ADD 
DATA").
....
handle_value(my_data,X,"GET DATA"),
write(X),nl.
....
rem_handle(my_data,_,"LOSE DATA").

ERRORS

A runtime error occurs if an invalid handle is given.

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

handle_value , rem_handle


BAP Online Manuals : Library Reference : Library by Name : new_handle
Previous: mkdir
Next: nl