Which command to delete partial in c ++?

3

Well as you know, system("cls") erases everything, I would like to delete it partially.

    
asked by anonymous 09.07.2015 / 15:44

1 answer

2

Clear specific texts already written can not. But you can replace the contents of what was already written on the line where the cursor is.

Marking "\ t" returns the cursor to the beginning of the line, which will replace the previous text. However, if the new text is smaller than the previous one, the previous characters from the end will be retained.

Ex:

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

/*
Saída

Frase anterior
*/

To return a character, use "\ 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 rewind the cursor to upper rows or change other rows, just the line where the cursor is.

    
09.07.2015 / 17:35