Writing to standard error from gnu-prolog

From: Roger Clayton (see_at_below.for.email)
Date: 04/26/04


Date: Mon, 26 Apr 2004 16:41:51 +1200

So here's the problem:
I need to report a message to the standard error stream
rather than the standard output in a gnu-prolog program.
(The program I writing is part of a compiler for a logic
programming language).

Although the gnu-prolog manual is excellent in most
respects, I'm having trouble finding the sequence of
builtin predicates to make this happen.

When the interactive environment is consulted for
available output streams, the results are:

------------
| ?- current_stream(X), current_alias(X,Y).

X = '$stream'(0)
Y = top_level_input ? ;

X = '$stream'(0)
Y = user_input ? ;

X = '$stream'(0)
Y = debugger_input ? ;

X = '$stream'(1)
Y = top_level_output ? ;

X = '$stream'(1)
Y = user_output ? ;

X = '$stream'(1)
Y = debugger_output

yes
--------

The fact that all the output aliases point to stream 1
makes me suspect that these are the same stream and,
moreover, none of these are actually labeled as the
standard error.

Any attempt to set the stream (using set_output/1) to
anything other than '$stream'(1) generates an
'existence error'. New streams generated using the
open/3 or open/4 predicates seem only to create output
files.

I hope someone out there has had some experience with
this and can point me in the right direction to make
this happen.

Thanks,

Roger Clayton

<merge these lines for email address>
rjc4 .waikato .nz
     @cs .ac



Relevant Pages

  • Re: Wrap up Text
    ... not using fflush() to ensure that the prompt will be displayed before the ... Hence to be -sure- that prompt will be visible, ... stdout is a text stream or a binary stream? ... FILE objects associated, respectively, with the standard error, ...
    (comp.lang.c)
  • Re: Handling errors in standard output statements with openmcl (learner questions)
    ... stream variable you can use to get your error output, ... its value is #<Stream for Standard Input>. ... PATHNAME: NIL. ... its value is #<Stream for Standard Error>. ...
    (comp.lang.lisp)
  • Writing to Standard Error from gnu-prolog
    ... rather than the standard output from a gnu-prolog program. ... predicates to make this happen. ... I suspect that all these are actually the same stream and, ... none of these are identified as the standard error. ...
    (comp.lang.prolog)