guile-user
[Top][All Lists]
Advanced

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

Re: Change every in/out port?


From: Martin Grabmueller
Subject: Re: Change every in/out port?
Date: Wed, 12 Dec 2001 13:20:43 +0100 (MET)

> From: Seong-Kook Shin <address@hidden>
> Date: Wed, 12 Dec 2001 04:15:59 +0900 (KST)
> 
> My program is a GUI program so that input/output to the
> stdin/stdout/stderr means nothing.
> 
> I want to change guile's input/output ports to the
> my internal buffers (e.g. char buf[...]).
> 
[...]
> Is there any simple method to achieve this?

If you simply want to bind the current input/output port to string,
you can do the following:

(with-input-from-string "hello"
  (lambda ()
    (with-output-to-string
      (lambda ()
        (display (read))))))

In this example, `read' reads the contents of the string "hello" and
`display' writes its output to a string, which is then returned.

Best regards,
  'martin



reply via email to

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