Advertisement

'scuse me while I CGI

Started by January 07, 2003 04:10 PM
3 comments, last by plugwatson 22 years, 1 month ago
Can anyone post a solution for C++ in Windows developing requiring input from a plain text file returned by a cgi request with variables sent in the address string. (Standard CGI from C++.. I am coding something with DPlay so assume we are connected)
CGI apps don''t get used much in Windows, and not even as much on Unix as they used to. Look into ISAPI if you want a solution that''s probably a bit more popular. The overhead for CGI is a bit of a concern if you''re talking about any serious amounts of traffic.
Advertisement
I guess I didn''t read this clearly enough. Is your program handling the CGI requests or is it making requests to a CGI script/program on a server?

If it''s handling the requests, you just need to rename your app with a .cgi extension and put it in your cgi-bin directory. You can get environment variables with the getenv() C function in stdlib.h. If you want to get the query string (after the question mark in the URL), call getenv( "QUERY_STRING" ). If you want to get data sent by POST forms, use atoi( getenv( "CONTENT_LENGTH" ) ) to find the number of bytes in the POST string and then use cin.get() for each byte.

If your program is requesting a plain text file from a CGI script/program on a server, you should look into the HTTP protocol, or find some sort of helper program that will download the file for you.

I use C++ CGI programs on my website (www.entropics.net) for news posting, the forum, and a counter. Speed is not really a concern because I don''t get a lot of traffic. I''d be happy to share source code (email: dc_tsunami@yahoo.com) if you want.
Really I was using CGI as a means to get IP address''s to then connect two players by DirectPlay so it wasn''t a speed issue just a one off connection. it would also download the data but it''s only a chess game so really a nice and simple function would be perfect if one exists??
Really I was using CGI as a means to get IP address''s to then connect two players by DirectPlay so it wasn''t a speed issue just a one off connection. it would also download the data but it''s only a chess game so really a nice and simple function would be perfect if one exists?? sorry the post was a little complicated to understand

This topic is closed to new replies.

Advertisement