README.md

December 5, 2022 ยท View on GitHub

Using C++ for CGI work.

Description

This isn't much, but it shows you how to use C++ to make CGI programs. NOTE: Please read "Explanations/Assumptions" for instructions on how to use this.

More Info

Compile this code, and start up PWS(Personal Web Server), set the directory permissions to read and execute, put the exe in the directory, then type:

http://localhost/nameofexe.exe

I will add more code later, but I don't have enough time right now...

If the code is successful, it should output "GET" minus the quotes.

Submitted On
ByDennis Wrenn
LevelBeginner
User Rating3.5 (14 globes from 4 users)
CompatibilityC, C++ (general), Microsoft Visual C++, Borland C++, UNIX C++
CategoryInternet/ Browsers/ HTML
WorldC / C++
Archive File

Source Code

#include <cstdio>
#include <string>
int main()
{
	using namespace std;
	char * pcReqMtd;
	fprintf(stdout, "Content-type: text/html\n\n");
	pcReqMtd = getenv("REQUEST_METHOD");
	fprintf(stdout, pcReqMtd);
	return 0;
}