Well, I'm developing my application in Linux, but after it's done, it will be used mostly on Mac OS.  So far, on regular basis, I test everything on my Mac to make sure it's working.  

I guess I'll have to find another way then.   One idea I have is to poll the size of the file every certain amount of time, and if it's different---there's my event.   Same applies to "date/time last modified".

Is there something I can use successfully on both Linux and Mac about that?

Just to mention that the file is a text file, and it doesn't change very often.  I mean, it's not constantly changing, so I'm not concerned with performance and resource issues.

Oh, here's another idea---every certain amount of time, I just compare my last saved version of the file to the current one---if different, there's my event.   What do you think?

O.

On 10/22/07, Erik de Castro Lopo <mle+ocaml@mega-nerd.com> wrote:
Orlin Grigorov wrote:

> Hi.
>
> This time I've done my research, but still I cannot find a good answer.
> Basically, I need to make a little ocaml process, which runs in the
> background and monitors a specific file for changes.   When a change occurs,
> I want it to back-up a copy of the version of the file at that moment.
> So, what I need is to set some signal or event, which will happen every time
> that file is changed.

If you are on Linux/Unix, have a look at Inotify. The Ocaml bindings are
here:

    http://tab.snarc.org/projects/ocaml_inotify/

HTH,
Erik
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Well behaved women rarely make history." -- Dorothy Parker

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs