469,619 Members | 2,113 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,619 developers. It's quick & easy.

Console Screen update - Iteration Count


I am writing a simple hardware test program in C that would run from
Windows command line.

Inside one of the loops, I have this code fragment that would display
the Iteration count.

{
....
system("cls");
printf("\nIteration:%d", i);
....
}

Since I have to clear the screen everytime I update the Iteration
count, there is lot of "FLICKERING".

Is there a better way to update the Iteration count without having to
clear the screen?

Regards,
Karthigan.

Nov 15 '05 #1
2 3820
ka*******@yahoo.com wrote:
I am writing a simple hardware test program in C that would run from
Windows command line.

Inside one of the loops, I have this code fragment that would display
the Iteration count.

{
...
system("cls");
printf("\nIteration:%d", i);
...
}

Since I have to clear the screen everytime I update the Iteration
count, there is lot of "FLICKERING".

Is there a better way to update the Iteration count without having to
clear the screen?

Regards,
Karthigan.

try something like... should help in reducing the flickering...
{
....
printf("%08d\b\b\b\b\b\b\b\b",i);
fflush(stdout);
.....
}
Nov 15 '05 #2
karthi...@yahoo.com wrote:
Inside one of the loops, I have this code fragment that would display
the Iteration count.
{
...
system("cls");
printf("\nIteration:%d", i);
...

}
Since I have to clear the screen everytime I update the Iteration
count, there is lot of "FLICKERING".
Is there a better way to update the Iteration count without having to
clear the screen?


this subroutine may be useful for you to scratch some ideas.
but if it is far from your problem, just forget it.
void process_bar(void)
{
unsigned int i;
unsigned long j = 0L;

printf("Copying......");
for(i = 1; i < 101; i++)
{
printf("%%%3d", i);
printf("\b\b\b\b");
j = 0L;
while (j < 60000000)
{
j++; /*delay)*/
}
fflush(stdout);
}
printf("\nCompleted!\n");
}

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by Dave | last post: by
11 posts views Thread by Totte Karlsson | last post: by
8 posts views Thread by Totte Karlsson | last post: by
16 posts views Thread by Chris Maloof | last post: by
1 post views Thread by karthigan | last post: by
4 posts views Thread by djc | last post: by
2 posts views Thread by sherifffruitfly | last post: by
2 posts views Thread by castironpi | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.