I am writing a cgi program in C. The CGI program has a link to start my tcp chat server... The tcp chat server prints some information when it starts... I have captured the informations and sent to the client browser through the cgi program... But the output is displayed all atonce...But my need is that i have to print the string immediately like how it gets printed on the terminal when i start the server.....
Can anyone help me with this issue...and provide me a detailed explanation
I could not even get that to compile. I had to add a line #include <stdio.h>
At that point, I got the timing effect that you wanted but the output is:
$ ./xx
Content-Type: text/html
HelloHaiByeHelloHaiBye$
You need to add some spaces and newlines to the printf's.
Run your program in the unix environment from the terminal. Do you still see line buffering? If so, your stdio package has a bug. If it works from the terminal but not in the browser, then the buffering must happening elsewhere.
I have mensioned in my question itself that i am using CGI program and i need to get the output in the browser.... I have added all the stdio.h and the <br> tag to get the output in the new line... But my exact requirement is that i have to get the output as
Hello Hai Bye
(after some time)
Hello Hai Bye
In the Browser when i call the cgi program which is written in C.