kasra Posted May 11, 2010 Posted May 11, 2010 Hi friends. Please help.... Assume that in the first time i have created a text-file and open it and write some text on it and then closed it by using lisp routine. Later, i whould open that file again and append some text at the next line in the file by using lisp routine. How is it possible to append some text at the next line in the file with out missing texts created before? thanks for your attention. Quote
MSasu Posted May 11, 2010 Posted May 11, 2010 Open the file using open function and "a" (append) as access mode: (setq MyInputObj (open MyFilePath "a")) Regards, Quote
Kerry Brown Posted May 11, 2010 Posted May 11, 2010 Perhaps something like ; (defun c:DoIt (/ filename fn line1 line2) (setq fileName "C:\\MyTextFile.txt" Line1 "A is for apple red and bright" Line2 "B is for bed where I sleep at night" ) (or (findfile fileName) (progn (setq fn (open fileName "w")) (close fn))) ;; ;; ;; bla-bla ;; (setq fn (open fileName "a")) (write-line Line1 fn) (close fn) ;; ;; ;; bla-bla ;; (setq fn (open fileName "a")) (write-line Line2 fn) (close fn) (princ) ) Quote
kasra Posted May 11, 2010 Author Posted May 11, 2010 Dear msasu and Dear Kerry Brown.... Your guides could answer to my request and I'm so thankful. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.