How to update a printed message in terminal without reprinting

try using \r instead of \n when printing the new “version”.

for(int i=0;i<=100;++i) printf("\r[%3d%%]",i);
printf("\n");

Leave a Comment