common lisp中获取当前文件路径

来源:互联网 发布:好用的数据恢复软件 编辑:程序博客网 时间:2024/05/20 11:35

1,直接获取当前文件夹的路径:

(print (probe-file ".") )

2.或许打开文件的大小:
(let ((file (open "hello.c" :if-does-not-exist nil)))  (print (file-length file))  (close file)  )

3.获取打开文件中的内容

(let ((in (open "hello.c" :if-does-not-exist nil)))  (when in    (loop for line = (read-line in nil)         while line do (format t "~a~%" line))    (close in))

4.判断文件是否存在:

(print (probe-file "hello.c") )


0 0