On Thu, Feb 28, 2008 at 02:45:58PM +0100, Fabrice Marchant wrote:
> I see there is a "Terminal interface" part in the Unix module.
> However I've no idea how to get currently set "columns" and "lines"
> used by "xterm" on my linux.
The Unix terminal interface is much lower-level -- it lets you control
line speed, character echo, etc.
You can use xterm escape sequences to do what you want.
They're documented in /usr/share/doc/xterm/ctlseqs.*, but many are
xterm-specific (they don't work in gnome-terminal for example).
If you run
echo -e "e[18t"
then xterm will respond with a line of the form
ESC [ 8 ; height ; width t
It generates this line as if it were typed input, so it can then be read by
your program on stdin. Doing this with printf and scanf in OCaml is
left as an exercise 
--
Eric Cooper e c c
c m u . e d u
.