manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.8.3 Readline Functions

The following functions are provided by

(use-modules (ice-9 readline))

There are two ways to use readline from Scheme code, either make calls to readline directly to get line by line input, or use the readline port below with all the usual reading functions.

Function: readline [prompt]

Read a line of input from the user and return it as a string (without a newline at the end). prompt is the prompt to show, or the default is the string set in set-readline-prompt! below.

(readline "Type something: ") ⇒ "hello"
Function: set-readline-input-port! port
Function: set-readline-output-port! port

Set the input and output port the readline function should read from and write to. port must be a file port (see section File Ports), and should usually be a terminal.

The default is the current-input-port and current-output-port (see section Default Ports for Input, Output and Errors) when (ice-9 readline) loads, which in an interactive user session means the Unix “standard input” and “standard output”.


This document was generated on February 3, 2012 using texi2html 5.0.