The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

*nix 'update in place' on the terminal

LegionnairedLegionnaired Registered User regular
edited July 2009 in Help / Advice Forum
I've been wanting to write some command line apps that update the screen,instead of just printing out a bunch of newlines with the correct information... Example: the `top` command.

How do I do this? Any language example will do, I'm sure I can work backwards once I understand the idea.

Legionnaired on

Posts

  • ÄlphämönkëyÄlphämönkëy Registered User regular
    edited July 2009
    There might be a less painful way, but I always use ncurses. I personally have only used it in Python and in C, but I know there are ports to pretty much every language.

    Älphämönkëy on
  • elmoelmo Registered User regular
    edited July 2009
    ncurses is what you want, gives you total screen control. Id suggest like alphamonkey to go with a script language like python, perl or ruby to begin with unless your familiar with c.
    Some of the script languages might have some wrappers for ncurses to simplify things, might also be worth looking into.

    elmo on
  • Jimmy KingJimmy King Registered User regular
    edited July 2009
    Another vote for ncurses. It's the easiest way I've found for dealing with that sort of stuff on the console (not that I've looked hard or often). There are plenty of examples and tutorials out there, but I can pass some of my code along to you. It's in C and from very early in my programming career, so I assure you, there's some stupid shit in there, but it does work.

    Jimmy King on
  • LegionnairedLegionnaired Registered User regular
    edited July 2009
    Gah, I had looked at the ruby-curses API and was hoping there was a better way. Meh. Console window systems are annoying, anyway. It's basically just a wrapper for ActiveResource to call over to a Rails backend, so there's little that would give you over a web page.

    Legionnaired on
  • ÄlphämönkëyÄlphämönkëy Registered User regular
    edited July 2009
    Gah, I had looked at the ruby-curses API and was hoping there was a better way. Meh. Console window systems are annoying, anyway. It's basically just a wrapper for ActiveResource to call over to a Rails backend, so there's little that would give you over a web page.

    If this is used to management / admin console, my favorite tool of the moment is to have webapps talking to the admins via IRC or Jabber. I hear twitter works if you are trusting of the twitter folk.

    This allows for out of band communication, text based input, and it doesn't require having to use curses :wink:

    Älphämönkëy on
Sign In or Register to comment.