Writing to same location using printf in C/C++

C, C++, Visual C++, C++.Net Topics
Post Reply
Jane
Corporal
Corporal
Posts: 10
Joined: Sun Jul 19, 2009 9:19 pm

Writing to same location using printf in C/C++

Post by Jane » Wed Oct 07, 2009 4:13 am

Code: Select all

printf("\b"); //backspaces on char
printf("\r"); //return to beginning of line
Example

Code: Select all

	for (i=0; i<1000; i++){

		printf("%d%%", i * 100/1000); // show percentage

		for (j=0; j<1000000; j++); // delay

		printf("\r");
	}
Post Reply

Return to “C/C++ Programming”