Q: I wrote a CGI program and compiled it with DJGPP, but it doesn't
seem to work....
A: If you are using a Windows Web server, it probably won't work. The reason is that Windows programs cannot easily redirect standard input and output of DOS programs (because DOS programs are run by Windows in a different Virtual Machine), and many Windows Web servers don't consider the case of a DOS CGI program, and don't bother to include the machinery necessary to do the redirection in a way that would work for DOS programs. So the output of your program never gets to the server.
Consult the docs of the server: it might include some feature that enables redirection from DOS programs. If that doesn't help, rebuild your CGI program with a Windows compiler, such as Mingw32 or Lcc-Win32 (see free Win32 compilers), and it will work.