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?