Browse thread
[Caml-list] GC and file descriptors
-
Dustin Sallings
- David Fox
- Nicolas George
- Mikael Brockman
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2003-11-13 (00:51) |
From: | Dustin Sallings <dustin@s...> |
Subject: | [Caml-list] GC and file descriptors |
I keep ending up with somewhat awkward structures to close files I've opened. Does the GC take care of any of this type of thing? I.e., could the following: let tput x = let r = Unix.open_process_in ("tput " ^ x) and buf = String.create 8 in let len = input r buf 0 8 in close_in r; String.sub buf 0 len ;; be written like this: let tput x = let buf = String.create 8 in String.sub buf 0 (input (Unix.open_process_in ("tput " ^ x)) buf 0 8) ;; safely? -- Dustin Sallings ------------------- 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