I know the question sounds strange but I tried to make it mor simpler . here's the real problem : I want to cout a messege and after the user has pressed a key, a part of the messege should disapear .
I tried this cout<<" wdjfnkjvnfkjvnkvdklvnfjkvfv";
if(_gettch()) cout<<(char)8;
it didn't delete anything
backspace=8;
sorry if my English is funy ( is't not my native language)
You're
close with cout << char(8) which is the same as cout <<
"\b". It puts the cursor back by one position. Now you need
to output a space to overwrite the last character. And another
"\b" to put the cursor back again. So every cout << "\b \b"
erases one character at a time.
deleting a character that was written at the command promt
Michael G
abehead12310
I know the question sounds strange but I tried to make it mor simpler . here's the real problem : I want to cout a messege and after the user has pressed a key, a part of the messege should disapear .
I tried this cout<<" wdjfnkjvnfkjvnkvdklvnfjkvfv";
if(_gettch()) cout<<(char)8;
it didn't delete anything
backspace=8;
sorry if my English is funy ( is't not my native language)
Frank Showalter
Aaron Mathison
TrulsTveoy
look for the space and then do what u want to do
cheers
moto822
thanks!
it works .
there stil is a probleme: if the messege is to long and it has to be written on 2
or more lines , cout<<(char)8; and cout<<"\b"; won't work!!!!!!!!!!!
ex : cout<<"fgfdjikgnfgkjnfskgsdfjhabfvhafbvfhvbfvjadbfjvhbfdvahdbfvhfadbvfdvfdv";
cout<<"dfdsfhgbjfdfNVVOBMNIBOBIBFJVVHBFHBhjbdfvafignbmifsoivjbnb";
cout<<"fbnkvjnkjnvkfjvnfkvjnjvfjvkvjkvvdfdfvfdkvfdlvjfdkvjfvkjfdvfvjkafjvvjfvnfjvnfv";
// x=lenght_of_messege;
for(int z=x ; z>0; z-- ) cout<<"\b";
only deletes the last line
how can I delete all lines