So the answer here is that I have to open "/dev/tty" each time I call it rather than reference my already-open "STDOUT"?

Hmmm....I'm disappointed that I need to open another file handle and can't get the rows & columns associated with my already open FH, "STDOUT", directly...

As for using 'Term::ReadKey', I thought of using something along those lines (or a Curses func), but wanted something that was minimal overhead, as this was called every loop, and portability isn't a major consideration, considering the nature of the program this is being used in is showing linux process and mounted-dev I/O.

If I look at /proc/$$/fd/1, I see a softlink to /dev/pts/1 (i.e. a character, tty type device). Indeed, if I use your 2nd prog and substitute in "/dev/pts/1" instead of "/dev/tty", I get the same result (ie. it works).

Shouldn't STDIN, STDOUT map to fd[0], fd1 => /dev/pts/1 on some level?

I.e. Shouldn't I be able to use some mapping function on STDOUT to get a file descriptor that's suitable for ioctl?


In reply to Re^2: Failing to get current TTY's rows & columns... by perl-diddler
in thread Failing to get current TTY's rows & columns... by perl-diddler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.