# About Code_Snippets:(cwd)

Started by alex, March 20, 2006, 12:11:31 PM

Previous topic - Next topic

alex

# About Code_Snippets:(cwd)

It can be shorter, I think:
(define (cwd) (first (exec (if (= (& 0xF (last (sys-info))) 6) "cd" "pwd"))))
[/code]

Sammo

#1
Hi Alex,



Your version is, indeed, shorter and more direct than the snippet that calls the Windows DLL, but it has the disadvantage of not working in the newLisp-tk environment on my WIN2K system. Anybody know why?



Thanks,

-- Sam

Lutz

#2
May be you have to do: (exec "cmd.exe /C cd")



Lutz



ps: I have put Alex's version as a second solution on the code-snippets page.



In a speed-sensitive situation the library import solution will be much faster, specially if the import has been done before, i.e. in init.lsp,  and during program execution the imported function is only called.