Hello folks,
I have a working CGI written in C. It uses the printf statement to build the outgoing HTML web page. I understand that printf is actually outoutting to the STDOUT device. I'd like to use the WriteFile statement to build the outgoing page and I've tried this:-

WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), &input, byt2wrt, &numwrt, NULL);

and it writes to the console OK when run under the VC++ IDE but fails in the CGI prog. I get Premature end of script headers: gencde.exe, referer: http://... in the Apache logfile.

Can anyone help me on this please?
Ta

my guess is the computer that runs the cgi program does not have .NET framefork installed or the wrong version. Use either fprintf() or cout and you won't have that problem.

It has Net 1.1 ? Is this the wrong version. Why does it need this to write to the STDOUT? Not certain I understand this.
Cheers

Herehttp://www.cs.tut.fi/~jkorpela/forms/cgic.html is one of probably many tutorials. stdout is treated in a special way in a web server, which redirects it back to the web browser. I don't know enough of the details to tell you much more -- just google for "cgi c programs" and you will get more information.