How do I set the current working directory on a windows system?
+2
A:
With Unix.chdir d
where d
is a string.
More related functions: Unix module
Pascal Cuoq
2009-09-25 01:11:53
what if I'm using windows?
Rosarch
2009-09-25 01:20:46
Well, if you're using Windows the library is still named Unix and contains the same functions. So it's different from the Windows API you're used to, but you are writing multi-platform code without effort.Note: I actually implemented the Windows version of module "Unix" during an internship at INRIA in 1993.
Pascal Cuoq
2009-09-25 01:24:15
I can't resist bragging a little since it's on-topic: http://mirror.ocamlcore.org/caml.inria.fr/pub/ml-archives/caml-list/1996/09/fa00da44a2bd17b3c9752ee328039bde.en.html
Pascal Cuoq
2009-09-25 01:26:01
It says "Reference to undefined global `Unix`"
Rosarch
2009-09-25 01:40:47
You need to link with the library Unix. Command like "ocamlopt -o progprog unix.cmxa module1.ml module2.ml". See details at http://www.ocaml-tutorial.org/compiling_ocaml_projects
Pascal Cuoq
2009-09-25 01:52:47
inside the interpreter, you can load the Unix library with `#load "unix.cma";;`
newacct
2009-09-25 02:22:45
There are certain Unix functions that are not implemented on Windows. See: http://caml.inria.fr/pub/docs/manual-ocaml/manual035.html
Chris Conway
2009-09-25 17:17:33