开发者

text editor using c

Hi i want to make a text editor using c. I don't want to make any GUI, the text editor is going to be a console application. I would like to 开发者_高级运维ask if there are any libraries which implement some basic functionality for example, i want to execute a function when user presses ctr+s.


You're going to want to look into the curses library. There are versions of it for most Unix-like systems as well as for console programs in Windows (and probably programs running under PowerShell, but not sure).

This library has functions for reading key presses, moving around the screen, and drawing window-ish borders with either ASCII or terminal graphics characters in a platform/terminal independent way. Some versions even have the ability to work with mice.

There's lots more that curses can help you do, but you'll have trouble appreciating it until you read more in depth about it and see some examples in action (and actually realize that they are using curses).

The most popular version for free *nix systems is ncurses and the windows version is called pdcurses.


Use ncurses and take a look at the the source code for vim.


Curses and other such libraries are a good place to start.

http://en.wikipedia.org/wiki/Curses_%28programming_library%29


You can find a simple ncurses-based text editor on my webpage here:

http://www.melvilletheatre.com/articles/cstuff/1.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜