Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Writing a file path to a *. txt file

4 REPLIES 4
Reply
Message 1 of 5
The_Caddie
347 Views, 4 Replies

Writing a file path to a *. txt file

I have a file path im trying to capture in a text file however its not working and autocad is prompting back,

 

; error bad argument type: streamp nil

 Im assuming its because of the slashbacks but Im not sure..

 

Herse the code sofar...

 

(defun C:GO ()

(SETQ ACADLSP (findfile "acad.lsp"))
(setq f (open "C:\test.txt" "w"))
(write-line ACADLSP f)
(close f)

)
4 REPLIES 4
Message 2 of 5
hmsilva
in reply to: The_Caddie

change

 

"C:\Test.txt"

 

to

 

"C:\\Test.txt""

 

Henrique

EESignature

Message 3 of 5
The_Caddie
in reply to: hmsilva

nope that aint it ( i noted that you accidentaly added an extra double quote) though still didnt work.

Message 4 of 5
hmsilva
in reply to: The_Caddie

this works for me

 

(defun C:GO ()
  (SETQ ACADLSP (findfile "acad.lsp"))
  (setq f (open "C:\\test.txt" "w"))
  (write-line ACADLSP f)
  (close f)
)

 

EESignature

Message 5 of 5
dicra
in reply to: The_Caddie

Try to run autocad as administrator,

 

I was having the same problem, I could create file on "D:" , but could not on "C:".

I think that is your problem, because I think that you cannot create a file on "C:" if you don't run autocad as administrator.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost