Hi Karim,
Thank you for your response.
My main doubt was about the pathname created through a global variable and if this solution works in all computers and systems (Windows, Mac and Unix). This is the code:
In the library main file
(in-package :om)
(defvar OMRead-txt-path (make-pathname :directory (append (pathname-directory load-pathname) (list “sources”))))
In the file where the functions are located
(in-package :OMRead-txt)
(defun string-to-list (str)
(if (not (streamp str))
(string-to-list (make-string-input-stream str))
(if (listen str)
(cons (read str) (string-to-list str))
nil)))
(defun read-text-file (string)
(let ((stream (open (merge-pathnames om::OMRead-txt-path (parse-namestring (concatenate 'string string “.txt”))))))
(om::flat-once (string-to-list stream))))
I was thinking about load multiple .txt files in the library “sources” folder and how to generate an automatic pathname to do so, without the necessity of the user to insert this pathname for each file. It is also a part of a bigger project for another library, where I intend to load .txt files with previous calculations (huge quantities of data).
Is it make any sense?
Best Regards,
Paulo.