Results 1 to 4 of 4

Thread: Get terminal variables

  1. #1

    Get terminal variables

    Does anyone know how i can read the $COLUMNS and $ROWS in a console application in Linux?

    When i try
    Code:
    for i := 0 to GetEnvironmentVariableCount do
                        Writeln(GetEnvironmentString(i));
    COLUMNS and ROWS are not listed.

    I would like to somehow execute "echo $COLUMNS" and pipe the result back to the program.

  2. #2
    The first thing coming to my head is to use the (deprecated, but oh well, still works) Shell() command and invoke "echo $COLUMNS > file.txt", then read from that file. Dirty as hell, I know.

  3. #3
    Thanks for your reply.

    That could work if i knew how to get a signal everytime the terminal was resized. As it is now i use ncurses Getwinxy in a loop. Writing to a file hundreds of times per second is not optimal. I can't believe a simple thing like this isn't available in a easy way in the crt unit, pretty basic stuff one would think.

  4. #4
    I haven't touched Linux for years but maybe you could use this tput tool as described in this post: http://stackoverflow.com/questions/2...s-from-php-cli

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •