the file name should be variable and not a string .
e.g .
Code:(setq filename "Complete path of file name HERE") (setq filename (open filename "w")) (write-line "Good Moring honey " filename) (close filename)


Registered forum members do not see this ad.
Hi All,
Help me know writing new lines to existing file.
eg. following line is existing in a file.
additional line to be written isCode:(write-line "Hello-World" "filename")
Thanks in advanceCode:(write-line "Good Morning" "filename")
Aaryan.
the file name should be variable and not a string .
e.g .
Code:(setq filename "Complete path of file name HERE") (setq filename (open filename "w")) (write-line "Good Moring honey " filename) (close filename)
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said
You should look to Append mode of OPEN function for files access.
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
Please try this code (don't remove the file):
Then this one:Code:(setq ff (open "C:\\test.txt" "w")) (write-line "1st line" ff) (setq ff (close ff))
Now, may test again the first excerpt to see the difference.Code:(setq ff (open "C:\\test.txt" "a")) (write-line "2nd line" ff) (setq ff (close ff))
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3


This is what i was missing APPEND mode.
Thank You So Much Mircea.
Regards
Aaryan
Bookmarks