Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Console Screen update - Iteration Count

Reply
Thread Tools

Console Screen update - Iteration Count

 
 
karthigan@yahoo.com
Guest
Posts: n/a
 
      09-01-2005

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.

 
Reply With Quote
 
 
 
 
Anand
Guest
Posts: n/a
 
      09-01-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) 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);
.....
}
 
Reply With Quote
 
 
 
 
kernelxu@hotmail.com
Guest
Posts: n/a
 
      09-02-2005
(E-Mail Removed) 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");
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts - Problem with nested iteration or double iteration Rudi Java 5 10-01-2008 03:30 AM
Console Screen update - Iteration Count karthigan@yahoo.com C Programming 1 09-01-2005 05:00 PM
XSLT - maintaining iteration count M.Kamermans XML 6 01-30-2005 03:15 AM
Count(*) in a Subquery with multiple tables: How does SQL determine which table to generate the Count() from? Kaimuri MCSD 3 12-29-2004 06:38 PM
I am adding a new row to the datagrid dynamically but if i use the Count property of Item it is not showing the count of the new rows being added Praveen Balanagendra via .NET 247 ASP .Net 2 06-06-2004 07:16 AM



Advertisments