sprintf does no such thing it simply puts a #0 after the end of the last character it created in the buffer to make an asciiz string. So if you had rubbish already up on the screen it obviously stays visible.
You need to right pad the string with spaces to the screen width or clear the screen before writing.
A hint is sprintf returns how many characters it put in the bufferhttps://www.tutorialspoin...c_function_sprintf.htm
If successful, the total number of characters written is returned excluding the null-character appended at the end of the string, otherwise a negative number is returned in case of failure.
post edited by LdB_ECM - 2019/12/06 03:10:01