ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I seem to find that getch() returns the exact same int value for CTRL+J, CTRL+M and ENTER. Is there anyway to differentiate them, or is there any other console key service that I can use to get characters as they are typed into the keyboard? (preferably one that allows the identification of whether CTRL/ALT is pressed along with the other keys. Thanks...
Also, in an editor, which container class do you think is best to store the edited text?
I dont know any container class in the standard library that is good at handling large text documents.
I once had to implement one myself. It uses leaves with arrays holding pointers to each line of text. All the nodes, including the leaves also hold a integer with the number of text lines stored in this subtree. The idea was to have fast random access to any line, while keeping inserts and deletes efficient. Note that no line numbers, just a count of lines is stored.
Wish I could post the code, but unfortunately its property of a company where i used to work.
kev82: yup, I've called keypad(stdscr,TRUE) and noecho(), raw() and the rest, I really have no idea what else I can do. Are there any other keyboard functions for consoles that I can use?
DIYLinux: I was thinking of something similar, but more of linked lists structure, a list for each line, keeps memory accesses fast but uses lots of memory for implementation, I think. Thanks anyway.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.