0
for ( i=0;i<a;i++ )
	{   
		
		qin.Echo();
		qin>>b; 
		if(b == (char)8) { total--;
		    cuv[i-2]=cuv[i-1];
			cuv[i-1]=0;
			i--;
		} else if(b!=char(13)){  // for key enter
				total++;
		space++;
		
			cuv[i]=b;  } else break;
		
		
	}

If pressed once or twice "backspace" works, but if pressed for more than two times, not working, first i checked for once "backspace" i make cuv[i-1]=cuv ; cuv=0;.. so i see for twice "backspace"... cuv[i-2]=cuv[i-1]; cuv[i-1]=0;... but i dont know how can i make this for more backspace.

ps: i dont want use strlen,or strchr;

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by KasmIR
0

I don't know what it is you're trying to do, but if i is less than 2 and "backspace" is pressed, you will try and access a negative index in the cuv array. This will definitely cause you a problem at some point.

0

for example if i write abcdefg and i press once"backspace", my array is abcdef;
if i press twice backspace my array is abcde .... but if i press more >=3 .. not work..
if you want , i can put all code.
Thank you !!!

Edited by KasmIR: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.