scsh-users
[Top] [All Lists]

read the whole file into a string?

To: scsh-news@zurich.csail.mit.edu
Subject: read the whole file into a string?
From: William Xuuu <william_xuuu@163.com>
Date: Tue, 08 Feb 2005 01:07:03 +0800
List-id: <scsh-users.list-id.scsh.net>
Organization: the Church of Emacs
Hi,

A simple question, how to read a file into one single string? I looked into
the manuals of scsh, only found this:

(read-string nbytes [fd/port])     --->     string or #f (procedure)
(read-string! str [fd/port start end]) --->     nread or #f (procedure)

I took a try:

(let* ((port (open-file "/tmp/foo" open/read))
       (str (read-string 100 port)))
  (display str))

Can someone give me a hint? 

thanks.

--
William

<Prev in Thread] Current Thread [Next in Thread>