Thread: backspace info

  1. #1
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534

    backspace info

    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.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    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
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Patent Pending GSLR's Avatar
    Join Date
    Sep 2001
    Posts
    134
    hi

    have you tried changing the keyboard layout

    cheers
    And To All Those Opposed, WELL !!!
    >Deleted< " Looks like a serial no."

  4. #4
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    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?

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    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/...&id=1043284385
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help displaying info from structure
    By kisiellll in forum C Programming
    Replies: 6
    Last Post: 04-04-2009, 12:51 PM
  2. Question about getting an info class from another Form
    By Joelito in forum C# Programming
    Replies: 0
    Last Post: 10-16-2006, 01:02 PM
  3. Help doing an e-mail program in c...
    By Tyler_Durden in forum C Programming
    Replies: 88
    Last Post: 01-02-2005, 03:12 PM
  4. Binary trees search problem...
    By Umoniel in forum C Programming
    Replies: 2
    Last Post: 02-22-2004, 02:29 PM
  5. Replies: 3
    Last Post: 12-06-2001, 05:30 AM