Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: flush file buffer, etc
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-09-02 (18:36)
From: Markus Mottl <mottl@m...>
Subject: Re: flush file buffer, etc
> > How do I flush a Unix.file_descr?

> On the other hand, if you want to really commit the writes to the hard
> disk, there is no function in the Unix module for this.  But I'm not
> even sure there exists a standardized Unix system call to do this.

Maybe "fsync" would be appropriate. According to the man page this system
call conforms to POSIX.1b (formerly POSIX.4).

> > Deterimine if a file_descr isatty?
> Your best bet is to make isatty() available in Caml. The following C
> wrapper and Caml declaration are all you need:

Another solution, which works with the existing library, would be 
to simply call "tcgetattr fd" and catch the possibly resulting error


  try ignore (tcgetattr fd) with Unix_error (ENOTTY,_,_) -> ...

Markus Mottl

Markus Mottl,,