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);
}
}

Recommended Answers

All 7 Replies

hmmm \b?

commented: haha.. +1

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

...
if(x==backspace) 
{
    i++;
}
...

:)

commented: Beautiful +10

what :)

gotoxy...SetCOnsoleCursorPos..

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.