users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: streams


From: Cliff Bender
Subject: Re: streams
Date: Tue, 6 Sep 2005 21:40:44 -0400

Vic, Alexandre,

Dunno why, but these methods seem to work. I have no idea why the method I showed doesn't, but this helps. I'm going to, i think, need to have to tie prolog and c together, later in the semester. When that happens, I'll be asking for help again... I hope I can count on you!

Thanks, and in advance as well,
Cliff

On 9/5/05, Vic Bancroft <address@hidden> wrote:
Cliff Bender wrote:

>I'd like some help trying to understand the use of streams.
>
Hurrms, not sure what is broken w/ your example, however, I tend to use
the format construct.

    $ gprolog
    GNU Prolog 1.2.18
    By Daniel Diaz
    Copyright (C) 1999-2004 Daniel Diaz
    | ?- assertz(p(1)), assertz(p(2)).

    yes
    | ?- open('out.log', write, H), (p(X), format(H, "p(~w) ~n", [X]),
    fail; close(H)), !.

    H = '$stream'(2)

    (1 ms) yes
    | ?- system('cat out.log').
    p(1)
    p(2)

    (1 ms) yes

This explicit indication of the target stream is useful in context where
there is more than one and it also gives you more control over what is
sent to the stream . . .

more,
l8r,
v

--
"The future is here. It's just not evenly distributed yet."
-- William Gibson, quoted by Whitfield Diffie



reply via email to

[Prev in Thread] Current Thread [Next in Thread]