IBM Tivoli Software IBM Tivoli Software

[ Bottom of Page | Previous Page | Next Page | Contents | Index ]


write

Write to an open file.

Synopsis

write(_file, _term)

Description

The value of _term is written to the file specified by the file pointer _file. Newline characters are not written.

Arguments

_file
The file pointer obtained from opening the file with the fopen predicate.
_term
The Prolog term to write.

Examples

This following example Tivoli Enterprise Console rule shows how to write data to the /tmp/event.txt file. It is not generally a good idea to write data to a file every time an event is received because it will degrade the performance of the event server.

rule: write: (
  event: _event of_class _class,
  action: write_assertions: (
    fopen(_fp, '/tmp/event.txt', 'w'),
    write(_fp, 'Event of class '),
    write(_fp, _class),
    write(_fp, ', '),
    write(_fp, _source),
    write(_fp, ' received.\n')
  ),
  action: close: (
    fclose(_fp)
  )
).

If an event of class Su_Success with source LOGFILE was sent, then the /tmp/event.txt file would contain the following text after the rule ran:

Event of class Su_Success, LOGFILE received.

See Also

None.


[ Top of Page | Previous Page | Next Page | Contents | Index ]