I have written a program in C== to handle cgi web requests. It runs fine in a terminal window and all the output that I expect is displayed. When I request it from firefox or IE I get just over 4KB of the 6KB expected. It seems size related, rather than position in the file as the place that it stops varies when I change the text in the first 4KB to make it longer or shorter. Im running Ubuntu 10.10 with the latest apache2 through updates for it. I do printf the "content-type: text/html\r\n\r\n" minimum header (I did have more before but have reduced it while trouble shooting). I then write " ............. where the header has script in it and the body has form definitions etc. The output stops shortly after the tag, but the exact position varies when I add or remove text earlier in the html script. Any help greatly appreciated as my development is now stopped dead in its tracks until I can get this to work. CAN A MODERATOR PLEASE MOVE THIS THREAD TO THE PROGRAMMING SECTION - SORRY I PUT I IN THE WRONG PLACE, it is aCGI programming issue.
[SOLVED} C++ seems to have an internal buffer around 4KB for stdout. So when you write to stdout, it discards after this limit has been exceeded. The solution is to break big writes into smaller printf's and after each printf do a fflush(stdout).