6

I want to write a program that can "draw" in the terminal the same way as htop or emacs. By that I mean "get rid of the prompt and make the output dependent on the current size of the terminal".

To make this a bit more clear:

I want to use the terminal this way:

enter image description here

in stead of this way:

enter image description here

townhall
  • 73
  • 1
  • 5

1 Answers1

6

There are plenty of ways to do that, from lowlevel ones to more high level apis.

Check out ncurses for C and dialog for bash.

This is a very complete tutorial for ncurses: http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/

Bruno9779
  • 1,353
  • 6
  • 19
  • What is the the functionality ncurses provides called? ("how do I google for this kind of thing?") – townhall Feb 17 '17 at 19:17
  • I added dialog for bash. It depends from what language you need the functionality for. I would google something like "ncurses for python" (which is PyNcurses) – Bruno9779 Feb 17 '17 at 19:19
  • 2
    @Bruno9779: I believe that townhall is asking “How do I do a Google search to find out that there is a thing called ‘ncurses’ if I don’t already know *that its name is ‘ncurses’*?” – Scott - Слава Україні Feb 17 '17 at 20:07
  • 2
    @townhall: I did a Google search for “full-screen unix programming”, and the eighth result (on the first page) was [How to write full-screen Linux console app/script?](//stackoverflow.com/q/14221317/1672723) (on [SO]), the answers to which mention curses and ncurses. – Scott - Слава Україні Feb 17 '17 at 20:07
  • See http://stackoverflow.com/a/39302351/340790 and http://unix.stackexchange.com/a/336635/5132 for some keywords. – JdeBP Feb 19 '17 at 00:18