Problem with backspace button

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2009
Posts: 8
Reputation: UGndLord is an unknown quantity at this point 
Solved Threads: 0
UGndLord UGndLord is offline Offline
Newbie Poster

Problem with backspace button

 
0
  #1
Feb 12th, 2009
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:
  1. char backspace=8;
  2. while(1)
  3. {
  4. x=getch();
  5. if (x=='\r')
  6. {
  7. s[i]='\0';
  8. break;
  9.  
  10. }
  11. if(isdigit(x) || x==backspace)
  12. {
  13. s[i]=x;
  14. i++;
  15. putch(x);
  16. }
  17. }
Last edited by UGndLord; Feb 12th, 2009 at 7:47 pm.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Problem with backspace button

 
1
  #2
Feb 12th, 2009
hmmm \b?
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 8
Reputation: UGndLord is an unknown quantity at this point 
Solved Threads: 0
UGndLord UGndLord is offline Offline
Newbie Poster

Re: Problem with backspace button

 
0
  #3
Feb 12th, 2009
i tryed that, and it's the same.
It works but text are not being deleted
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 320
Reputation: cikara21 is an unknown quantity at this point 
Solved Threads: 63
cikara21's Avatar
cikara21 cikara21 is offline Offline
Posting Whiz

Re: Problem with backspace button

 
1
  #4
Feb 12th, 2009
  1. ...
  2. if(x==backspace)
  3. {
  4. i++;
  5. }
  6. ...
Last edited by cikara21; Feb 12th, 2009 at 9:02 pm.
.:-cikara21-:.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 8
Reputation: UGndLord is an unknown quantity at this point 
Solved Threads: 0
UGndLord UGndLord is offline Offline
Newbie Poster

Re: Problem with backspace button

 
0
  #5
Feb 12th, 2009
what
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 320
Reputation: cikara21 is an unknown quantity at this point 
Solved Threads: 63
cikara21's Avatar
cikara21 cikara21 is offline Offline
Posting Whiz

Re: Problem with backspace button

 
0
  #6
Feb 12th, 2009
gotoxy...SetCOnsoleCursorPos..
Last edited by cikara21; Feb 12th, 2009 at 9:11 pm.
.:-cikara21-:.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 8
Reputation: UGndLord is an unknown quantity at this point 
Solved Threads: 0
UGndLord UGndLord is offline Offline
Newbie Poster

Re: Problem with backspace button

 
0
  #7
Feb 12th, 2009
How can i solve that with gotoxy?
I dont understand.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 8
Reputation: UGndLord is an unknown quantity at this point 
Solved Threads: 0
UGndLord UGndLord is offline Offline
Newbie Poster

Re: Problem with backspace button

 
0
  #8
Feb 12th, 2009
?
Last edited by UGndLord; Feb 12th, 2009 at 9:32 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC