How to write an application that uses the terminal

2020-07-13 11:40发布

I'd like to write an application (in C) that uses the terminal of a *nix OS as its GUI. I mean an application of the kinds of emacs, vi etc. that take up the whole terminal window and jump back to the input prompt after quitting.
How would you go about doing that, preferably in C? Can someone point me to a tutorial covering that?

4条回答
贼婆χ
2楼-- · 2020-07-13 11:47

Use a library like ncurses, it is specifically designed for this purpose.

查看更多
Anthone
3楼-- · 2020-07-13 11:59

Well, actually this is not GUI (graphic user interface) but a text based interface. You can use the library ncurses to create such applications in C.

查看更多
三岁会撩人
4楼-- · 2020-07-13 12:03

You need to use ncurses:

http://en.wikipedia.org/wiki/Ncurses
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/

It is available on all major distros.

查看更多
乱世女痞
5楼-- · 2020-07-13 12:05

Throwing in alternate solutions so that this question thread does not look so monotonic:

  • the slang library (mc uses it, for example)
查看更多
登录 后发表回答