943,812 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1049
  • C++ RSS
Feb 12th, 2009
0

Problem with backspace button

Expand Post »
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:
C++ Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
UGndLord is offline Offline
8 posts
since Feb 2009
Feb 12th, 2009
1

Re: Problem with backspace button

hmmm \b?
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Feb 12th, 2009
0

Re: Problem with backspace button

i tryed that, and it's the same.
It works but text are not being deleted
Reputation Points: 10
Solved Threads: 0
Newbie Poster
UGndLord is offline Offline
8 posts
since Feb 2009
Feb 12th, 2009
1

Re: Problem with backspace button

C++ Syntax (Toggle Plain Text)
  1. ...
  2. if(x==backspace)
  3. {
  4. i++;
  5. }
  6. ...
Last edited by cikara21; Feb 12th, 2009 at 9:02 pm.
Reputation Points: 47
Solved Threads: 69
Posting Whiz
cikara21 is offline Offline
340 posts
since Jul 2008
Feb 12th, 2009
0

Re: Problem with backspace button

what
Reputation Points: 10
Solved Threads: 0
Newbie Poster
UGndLord is offline Offline
8 posts
since Feb 2009
Feb 12th, 2009
0

Re: Problem with backspace button

gotoxy...SetCOnsoleCursorPos..
Last edited by cikara21; Feb 12th, 2009 at 9:11 pm.
Reputation Points: 47
Solved Threads: 69
Posting Whiz
cikara21 is offline Offline
340 posts
since Jul 2008
Feb 12th, 2009
0

Re: Problem with backspace button

How can i solve that with gotoxy?
I dont understand.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
UGndLord is offline Offline
8 posts
since Feb 2009
Feb 12th, 2009
0

Re: Problem with backspace button

?
Last edited by UGndLord; Feb 12th, 2009 at 9:32 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
UGndLord is offline Offline
8 posts
since Feb 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Delete file thats in use
Next Thread in C++ Forum Timeline: How do i format my numbers correctly?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC