2011-11-04 2 views
2

텍스트 파일을 읽고 시퀀스로 만들고 전달하려고합니다. 어떻게해야합니까?Common Lisp의 텍스트 파일에서 연속으로 읽음

(with-open-file (stream "filename.txt") 
    (format t "~a~%" (read-line stream))) 

텍스트 파일은 다음과 같다 :

Hello this is a sentence. 
Hello this is second sentence. 

답변

3
(with-open-file (in "filename.txt") 
    (with-output-to-string (out) 
    (loop :for line := (read-line in nil) :while line :do 
     (write-line line out))))) 

내가 지금까지 무엇을 가지고
관련 문제