Visual LISP, AutoLISP and General Customization
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
How to append to textfile and record the date variable (code needs checking)
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
52 Views, 2 Replies
02-22-2012 08:00 AM
I have forgotten how to append I’m assuming its not write-line but append line could somebody confirm this.
And also
I’m having trouble recording the date variable… I keep getting error bad argument type stringp nil
; Appends usage count by DATE long variable... (setq g(open "C:/ICT/AutoCAD_Architecture_suite_2012/CUSTOM/WOOD Clones/PEN/USSAGELOG.PEN" "w")) (setq MYDATE DATE) (write-line MYDATE g) ; AS ABSOLUTE LAST WE NEED TO CLOSE THE TEXTFILE... (close g) I have the following code snippet I’m trying to append the file named USAGELOG.TXT to record the date of executions
Solved! Go to Solution.
Re: How to append to textfile and record the date variable (code needs checking)
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-22-2012 08:14 AM in reply to:
The_Caddie
Maybe this change "w" to "a"
(setq g(open "C:/ICT/AutoCAD_Architecture_suite_2012/CUSTOM/WOO
(setq g(open "C:/ICT/AutoCAD_Architecture_suite_2012/CUSTOM/WOO
Southie
Re: How to append to textfile and record the date variable (code needs checking)
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-22-2012 08:24 AM in reply to:
southie
Changing 'w' to 'a' appends the file instead of overwriting. If you want to append lines in the file you'll have to read the entire file and save them to variables. Then append them with code and write everything back to the file.
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)

