What command to delete partial in c++?

Asked

Viewed 1,489 times

3

Well, how do you know system("cls") erases all, would like command to delete partially.

  • 1

    Good morning, could inform partially erase how exactly?

  • It is not quite duplicated, but I believe that in this other question you may have the answer to your question: http://answall.com/questions/58453/como-fazer-efeito-de-loading-no-terminal-em-apenas-uma-linha/58480#58480

1 answer

2


Specifically deleting already written texts has no way. But you can replace the content of what has already been written on the line where the cursor is.

The tag " t" returns the cursor at the beginning of the line, what is written will replace the previous text. However if the new text is smaller than the previous one the previous characters of the end will be kept.

Ex:

printf("Texto anterior");
printf("\rFrase");

/*
Saída

Frase anterior
*/

To return a character is used " b". Ex:

printf("Pedro foi morto");
printf("\b\b\b\b\b\b\b\b\b\b se suicidou");

/*
Saída
Pedro se suicidou
*/

There is no way to move the cursor back to top lines or change other lines, only the line where the cursor is.

  • Did you answer your question? That’s what you wanted to know?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.