问题
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?
回答1:
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.
回答2:
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.
回答3:
Use a library like ncurses, it is specifically designed for this purpose.
回答4:
Throwing in alternate solutions so that this question thread does not look so monotonic:
- the slang library (mc uses it, for example)
来源:https://stackoverflow.com/questions/8547033/how-to-write-an-application-that-uses-the-terminal-as-gui-in-c