backspace info [Archive] - C Board

PDA

View Full Version : backspace info


kermit
11-24-2003, 04:54 PM
I am writing a program that runs in a terminal - I would like to be able to correct typing mistakes, however when I use backspace I get this:

^H

Is there a way that I can get the backspace (as well as the cursor keys) to work in my program? There are some slightly helpful articles in the FAQ, and I might end up fiddling with them - looks like maybe it would be cool if vVv's stuff was still up here though... Anyway, any help would be much appreciated.

Hammer
11-24-2003, 05:26 PM
Do you get ^H whenever you hit backspace, even when running in a shell?

If so, try:
stty erase ^H
(where ^H is you hitting the backspace key)
http://www.cec.wustl.edu/help/unix/delete.html

GSLR
11-28-2003, 05:58 AM
hi

have you tried changing the keyboard layout

cheers

kermit
11-28-2003, 06:29 AM
Hammer: - the backspace and cursor keys work fine in the shell when I am not running a program.

GSLR: - do you mean changing the keyboard layout from within the program I am trying to run?

Hammer
11-28-2003, 02:55 PM
Post your code that reads from the keyboard.

To get the backspace into the program, you'll need something that will get unbuffered IO. Try the mygetch() function here
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1042856625&id=1043284385