Thread: Delete Character

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    Delete Character

    Hello,

    Currently I am working on some simple shell programming utilities that mimic capabilities of editors. Most everything I want is working, and I have standard input set to non canonical mode. I am able to successfully trap the backspace and delete key, and after that I want to be able to delete a character from the screen. I am achieving this by printf("\b"), however on some terminals this only seems to perform a backspace, and leaves the previously printed character on the screen. I am able to get around this with printf("\b \b"), however I was wondering if there is a better way to do this?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I'm going to guess this is because terminals can be set to interpret the backspace key in different ways.

    If by "shell programming utilities" you mean you are actually coding this stuff in bash, you are stuck. Otherwise, just use a library like ncurses.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Delete Function in Doubly Linked List
    By Dampecram in forum C Programming
    Replies: 5
    Last Post: 11-15-2008, 04:30 PM
  2. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. why delete[] and delete?
    By dude543 in forum C++ Programming
    Replies: 4
    Last Post: 11-26-2005, 11:55 PM
  5. Problem need help
    By Srpurdy in forum C++ Programming
    Replies: 1
    Last Post: 07-24-2002, 12:45 PM