954,504 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with backspace button

Hi!
This is my first post here :) and I'm not good with english :)
I hope that you will understand :)
I'm trying to enter a string with only numbers. I solved this but i dont know how to enable delete (backspace button) ?
I solve and this problem but backspace works (arrow go back) but text are not being deleted?
How can i solve this problem?
Here code example:

char backspace=8;
while(1)
{
x=getch();
if (x=='\r') 
{
s[i]='\0';
break;

}
if(isdigit(x) || x==backspace) 
{
s[i]=x;
i++;
putch(x);
}
}
UGndLord
Newbie Poster
8 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 
Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

i tryed that, and it's the same.
It works but text are not being deleted :(

UGndLord
Newbie Poster
8 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 
...
if(x==backspace) 
{
    i++;
}
...

:)

cikara21
Posting Whiz
340 posts since Jul 2008
Reputation Points: 47
Solved Threads: 69
 

what :)

UGndLord
Newbie Poster
8 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

gotoxy...SetCOnsoleCursorPos..

cikara21
Posting Whiz
340 posts since Jul 2008
Reputation Points: 47
Solved Threads: 69
 

How can i solve that with gotoxy?
I dont understand.

UGndLord
Newbie Poster
8 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 
UGndLord
Newbie Poster
8 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You