On Fri, 13 May 2005, David Emerson wrote:

> Hi all,
> 
> Is there a function to query the terminal width and height, as a number of 
> characters?
> 
> For example, in windows 98, the terminal is always 80 characters wide, but 
> the height varies; in linux, the height and width can both change, even while 
> the program is running. I'm throwing some text up on the screen and would 
> like to be able to format it to fit the terminal width and height.

On unix, use fpioctl:

fpioctl(stdinputhandle, TIOCGWINSZ, @WS);

where ws is TWinSize:

  TWinsize = packed record
    ws_row,
    ws_col,
    ws_xpixel,
    ws_ypixel : word;
  end;

fpioctl is in unit unix, TWinSize in unit termio.

Michael.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to