Console width

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?ISO-8859-1?B?QW5kcukgSORuc2Vs?=

    Console width

    Hi,

    when I use PHP on the command line, is there a way to get the current
    console's width (in characters)?

    Regards,
    André
  • Jerry Stuckle

    #2
    Re: Console width

    André Hänsel wrote:
    Hi,
    >
    when I use PHP on the command line, is there a way to get the current
    console's width (in characters)?
    >
    Regards,
    André
    >
    Not directly, and I can't seem to find a way to do it indirectly. For
    instance, you can get some info from the ANSI escape sequences if the
    system supports them (most do nowadays), but it doesn't look like width
    is one of them.

    It sounds like it could be useful, though.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • C. (http://symcbean.blogspot.com/)

      #3
      Re: Console width

      On 26 Mar, 13:27, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      André Hänsel wrote:
      Hi,
      >
      when I use PHP on the command line, is there a way to get the current
      console's width (in characters)?
      >
      >
      Not directly, and I can't seem to find a way to do it indirectly. For
      instance, you can get some info from the ANSI escape sequences if the
      system supports them (most do nowadays), but it doesn't look like width
      is one of them.
      >
      I'd have thought it would be in ncurses but a quick gander at the dox
      did not turn up anything relevant. The 'resize' command works with
      most terminals (except weird things like Data General 400s) and is
      driven by the data in Termcap -you could laways run it from PHP or
      read its source code.

      C.

      Comment

      Working...