kasra Posted May 11, 2010 Share 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 Link to comment Share on other sites More sharing options...
MSasu Posted May 11, 2010 Share Posted May 11, 2010 Open the file using open function and "a" (append) as access mode: (setq MyInputObj (open MyFilePath "a")) Regards, Quote Link to comment Share on other sites More sharing options...
Kerry Brown Posted May 11, 2010 Share 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 Link to comment Share on other sites More sharing options...
kasra Posted May 11, 2010 Author Share Posted May 11, 2010 Dear msasu and Dear Kerry Brown.... Your guides could answer to my request and I'm so thankful. Quote Link to comment Share on other sites More sharing options...
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.