tags:

views:

65

answers:

1

Any one here used C based CGI??

I have this server side code :

while (cgiFormFileRead(file, b, sizeof(b), &got_count) == cgiFormSuccess)
        {
        fwrite(b,sizeof(char),got_count,output);
        i++;
                if(i == inc && j<=100)
                {
                fprintf(fptr, "%d" ,j);
                fseek(fptr, 0, SEEK_SET);*/
                i = 0;
                fflush(fptr);
                j++;
                }
        }

I am reading this file in Ajax to display a progress bar. However, the CGI doesn't start writing as expected in above code. Instead, may be after its done with all other stuff. Or may be it is not available to other process until it has finished writing the whole file or may be finished executing the whole program.

A: 

Yes, actually I did.

picknick
So do u have any idea whats going on here??My Ajax can not read the updated data from file.
Punit
I'm not quite getting what you are asking here. Are you asking how to read the environment variables?
picknick
NO. I am asking how can I make my data in CGI available to Ajax.For this I am writing data to a text file, however it is not available until the whole file is written.So, do you know any other way by which I can make my dynamic variable/data available at the client side ie to Ajax.
Punit