Lisp HUG Maillist Archive

How to get no-buffer io?

Hi, LispWorks Users

Simple question but can't google any solution, sorry.

I want a program which loop for inputing lines one-by-one and echo them.
In Perl I can do this:

#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
        my $input = $_;
        print $_;
}

In LispWorks, I wrote this:

(defun main-loop ()
  (let ((input (read-line *terminal-io* nil nil)))
    (when input
      (write-line input)
      (main-loop))))

I found this cannot worked. I delivered this program in LispWorks and
run it, I found (read-line) didn't return until program be break. I
think LispWorks has buffer IO which hold my input.

Is it any solution? Thanks very much.

Chun Tian (binghe)



Re: How to get no-buffer io?

Unable to parse email body. Email id is 6822

Updated at: 2020-12-10 08:45 UTC