When I write
(print "Hello!")
I get "Hello!" printed immediately.
However if I do
(with-open-file (*standard-output* "/tmp/foo" :direction :output
:if-exists :append
:if-does-not-exist :create)
(print "Hello!")
(read))
I don't see nothing in /tmp/foo until I type something and READ
returns. I could add (FORCE-OUTPUT) after PRINT. However the question
is: is it possible to get the same for the file stream as for
*terminal-io*? e.g. no buffering?
I mean something like
setvbuf( stream, (char *)NULL, _IOLBF, 0);
?
--
Vladimir Zolotykh
Create a new package (`my-cl') and define your own version of `print'
there that calls `force-output' after the `cl:print' call.
--
mvh,
Lars Rune Nøstdal
http://lars.nostdal.org/
Vladimir Zolotykh <······@eurocom.od.ua> writes:
> When I write
>
> (print "Hello!")
>
> I get "Hello!" printed immediately.
> However if I do
> (with-open-file (*standard-output* "/tmp/foo" :direction :output
> :if-exists :append
> :if-does-not-exist :create)
> (print "Hello!")
> (read))
>
> I don't see nothing in /tmp/foo until I type something and READ
> returns. I could add (FORCE-OUTPUT) after PRINT. However the question
> is: is it possible to get the same for the file stream as for
> *terminal-io*? e.g. no buffering?
>
> I mean something like
> setvbuf( stream, (char *)NULL, _IOLBF, 0);
> ?
Not portably. Check the documentation of the implementation you use,
it may have an implementation specific way to do it.
--
__Pascal Bourguignon__ http://www.informatimago.com/
Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.