views:

138

answers:

1

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
what if I'm using windows?
Rosarch
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
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
It says "Reference to undefined global `Unix`"
Rosarch
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
inside the interpreter, you can load the Unix library with `#load "unix.cma";;`
newacct
There are certain Unix functions that are not implemented on Windows. See: http://caml.inria.fr/pub/docs/manual-ocaml/manual035.html
Chris Conway