Browse thread
Re: flush file buffer, etc
- Markus Mottl
[
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: | -- (:) |
| From: | Markus Mottl <mottl@m...> |
| Subject: | Re: flush file buffer, etc |
> > How do I flush a Unix.file_descr? [snip] > 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 "ENOTTY". E.g.: try ignore (tcgetattr fd) with Unix_error (ENOTTY,_,_) -> ... Regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl