[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: (BUG LISPM) at MIT-AI
- Subject: Binary i/o
- From: Henry at MIT-AI (Henry Lieberman)
- Date: Sat ,19 Apr 80 18:26:00 EDT
I tried writing a binary file and reading it back in.
What seems to happen is that you wind up reading
past the end of file.
(WRITE-BINARY-FILE) followed by (READ-BINARY-FILE)
returns a list with the stuff written and a lot of extraneous garbage
at the end.
(EVAL-WHEN (EVAL LOAD COMPILE)
(COND ((NOT (STATUS FEATURE LOOP)) (LOAD "liblsp;loop") (SSTATUS FEATURE LOOP))))
(DEFUN READ-BINARY-FILE ()
(LET ((FILE (OPEN "henry;use less" '(READ FIXNUM))))
(LOOP FOR NEXT-WORD = (TYI FILE 'END-OF-FILE)
UNTIL (EQ NEXT-WORD 'END-OF-FILE)
(DEFUN WRITE-BINARY-FILE ()
(LET ((A-FILE (OPEN "henry;use less" '(WRITE FIXNUM))))
(TYO 17. A-FILE)
(TYO 69. A-FILE)