home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp
- Path: sparky!uunet!spool.mu.edu!uwm.edu!linac!att!cbnewsm!cbnewsl!davel
- From: davel@cbnewsl.cb.att.com (David Loewenstern)
- Subject: Re: a problem with reading a stream
- Organization: AT&T Bell Labs, Whippany, NJ
- Date: Mon, 28 Dec 1992 19:10:19 GMT
- Message-ID: <1992Dec28.191019.18212@cbnewsl.cb.att.com>
- In-Reply-To: rs69@cunixb.cc.columbia.edu's message of Sun, 27 Dec 1992 01:45:28 GMT
- References: <1992Dec27.014528.17943@news.columbia.edu>
- Lines: 34
-
- ... On Sun, 27 Dec 1992 01:45:28 GMT, rs69@cunixb.cc.columbia.edu (Rong Shen) said:
- } Hi experts:
-
- Barmar must be on vacation... so a non-expert will have to handle it 8^).
-
- } I am trying to write a function that asks a path to a file
- } from the user and opens the file to read. There is no problem with
- } opening the file, but when it tries to read, the interpreter
- } complains.
-
-
- } (defun read-path ()
- } (format t "Enter the path to the file to read, e.g. /tmp/foo/faq.txt")
- } (setf file-path-name (read-line))
- } (setf what-stream (open file-path-name :direction :input)) ; ok
-
- } (read what-stream nil 'This-is-the-end-of-the-world)) ; This line has error;
-
- Let me guess: faq.txt doesn't contain an s-expression? Remember, READ
- reads an s-expression. You may want READ-LINE, or READ-CHAR.
-
- Also: it's usually bad style to use OPEN. Use WITH-OPEN-FILE instead.
-
- (WITH-STANDARD-DISCLAIMERS
- (MAKE-INSTANCE 'Signature
- :NAME "David Loewenstern"
- :LOCATIONS '((INTERNET "David.Loewenstern@att.com")
- (INTERNET "loewenst@paul.rutgers.edu")
- (AT&T "201-386-6516"))
- :AFFILIATIONS '("AT&T Bell Labs" "Rutgers, Dept of CS")
- :SILLY-QUOTE (UNIX:SHELL "/usr/bin/fortune"))))
-
-
-
-