Page 1 of 1
# About Code_Snippets:(cwd)
Posted: Mon Mar 20, 2006 8:11 pm
by alex
# About Code_Snippets:(cwd)
It can be shorter, I think:
Code: Select all
(define (cwd) (first (exec (if (= (& 0xF (last (sys-info))) 6) "cd" "pwd"))))
[/code]
Posted: Mon Mar 20, 2006 8:34 pm
by Sammo
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
Posted: Mon Mar 20, 2006 9:04 pm
by Lutz
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.