Delete character command in C?

Is there a command to delete the previous character in the C?

Page 1 of 1

3 Replies - 940 Views - Last Post: 14 April 2010 - 07:13 AM Rate Topic: -----

#1 Naitogunjin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 02-March 10

Delete character command in C?

Posted 13 April 2010 - 02:47 PM

Hello everyone is there a command in C for deleting the previous character?

For example:
I want to be able to display some text and then delete the last character, but show it first before it deletes. I know about system("CLS") but that deletes the whole line.
I know its a weird thing to want, but its for design purposes.
If you know of such thing or if it even exists then let me know.
Thanks.
Is This A Good Question/Topic? 0
  • +

Replies To: Delete character command in C?

#2 IngeniousHax  Icon User is offline

  • |>|20-514<|{3|2

Reputation: 78
  • View blog
  • Posts: 1,358
  • Joined: 28-March 09

Re: Delete character command in C?

Posted 13 April 2010 - 03:53 PM

copy the text that is displayed to the screen and than print it back out without the last character?
Was This Post Helpful? 0
  • +
  • -

#3 angelcalling  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 08-August 09

Re: Delete character command in C?

Posted 14 April 2010 - 06:56 AM

use the command \b this will delete single character.
Was This Post Helpful? 0
  • +
  • -

#4 r.stiltskin  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1833
  • View blog
  • Posts: 4,927
  • Joined: 27-December 05

Re: Delete character command in C?

Posted 14 April 2010 - 07:13 AM

#include <stdio.h>

int main() {
  printf( "hello" );
  fflush( stdout );
  sleep(2);
  putchar('\b');
  putchar(' ');
  fflush( stdout );
  sleep(2);
  putchar('\n');
}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1