Version française
Home     About     Download     Resources     Contact us    
Browse thread
Trouble with Scanf and files
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christopher Kauffman <kauffman@c...>
Subject: Trouble with Scanf and files
I have encountered some difficulty using Scanf with a large number of files. As 
suggested in the the Ocaml manual, my strategy so far when reading a number of 
files has been to use Scanf.Scanning.from_file to create a scanbuf for each 
file. I had always wondered if this would cause problems with large numbers of 
files because I could not figure out a way to close a file after completing 
operations on it. Today I attempted to process too many and received a fatal 
system error. If one allocates a scanbuf via

let b = Scanf.Scanning.from_file "somefile" in ...

is there a way to subsequently close the file when the buffer is no longer 
needed? Or is this an issue that should be taken care of by the garbage 
collector in some strange way?

Cheers,
Chris Kauffman