LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-05-2003, 11:50 PM   #1
deveraux83
Member
 
Registered: Jul 2003
Location: Malaysia
Distribution: Red Hat, Slackware 9.1
Posts: 76

Rep: Reputation: 15
ncurses getch()


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?
 
Old 08-06-2003, 03:55 AM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
have you called keypad(stdscr, TRUE);

probably a large string
 
Old 08-06-2003, 06:03 AM   #3
DIYLinux
Member
 
Registered: Jul 2003
Location: NL
Distribution: My own
Posts: 92

Rep: Reputation: 18
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.
 
Old 08-06-2003, 07:27 AM   #4
deveraux83
Member
 
Registered: Jul 2003
Location: Malaysia
Distribution: Red Hat, Slackware 9.1
Posts: 76

Original Poster
Rep: Reputation: 15
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Where is getch()....... rajsun Programming 2 03-28-2005 11:40 AM
Help with getch... darkarcon2015 Programming 4 09-12-2004 08:48 AM
Equivalents of the getch() from conio.h in curses and ncurses aneeshm Programming 1 09-11-2004 07:19 AM
how to get getch() working with c++ cool_ashwin22 Programming 3 08-03-2004 10:58 AM
ncurses-5.2-28 conflicts with file from package ncurses-5.2-12 tubby Linux - Software 4 06-16-2002 12:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration