I have been tinkering with a fairly simple program. One of the goals is to fetch a character from a text file and print it to the screen. This done in a loop with a delay so that, let's say, "Hello World.", would print 1 letter per second.
Where LL is a value I'm tinkering with to control the amount of delay...
Code:
for (cntr3=0; buffmain[cntr3]!='\0'; cntr3++)
{
printf("%c", buffmain[cntr3]);
for (time1=0; time1<LL; time1++)
{
;
}
}
The problem seems to be that instead of printing a character, then completing the |||for||| loop, then starting over, is that the entire contents of |||buffmain||| are printed to the screen, then, it seems the |||for||| loop is run consecutively |||cntr3||| number of times separately.
I think I have a, "feel", for what is happening here, but if anyone can elaborate on the, "why", It would be greatly appreciated. I originally started out using |||usleep()|||, but tried doing it this way as the same problem arose.
I'm working with the GNU GCC compiler if that makes a difference. Also, is there any way around this to achieve the desired effect?