Hello I am new to CGI programming in C.
What I'm looking to do is, per the title, print things dynamically. For instance, consider this code that prints out a bunch of numbers:
int main()
{
long int l=0;
printf("Content-Type: text/plain;charset=us-ascii\n\n");
while(1)
{
printf("%li ", l);
if ((l%30) == 0)
printf("\n");
if (l == 5000)
exit(1);
++l;
usleep(3000);
}
}
The issue with it is that it doesn't print until the whole thing finishes. How do I go about getting things to print exactly as they would on a terminal?