Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] how to do a browser
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: IKEDA Katsumi <ikeda@m...>
Subject: Re: [Caml-list] how to do a browser
Hi,

From: "deerf hal" <halnaf@hotmail.com>
Message-ID: <F63peKIf5jJSzhI7Vjo00008db8@hotmail.com>
> 
> i have look to ocamlbrowser sources but it is a little bit hard to 
> understand the code.
> i suppose that could be done with a listbox (with option brower) but i don't 
> know how to have the list of the files of a directory
> thank

To have it, use Unix.opendir and Unix.readdir.

For example,

let my_ls path =
  let dh = Unix.opendir path in
  try
    while (true) do
      print_endline (Unix.readdir dh);
    done
  with End_of_file -> ();;
# my_ls "/usr";;

Regards,

-- 
IKEDA Katsumi  <ikeda@msi.co.jp>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners