CGI C++ Helper

After starting on the Automatic Scheduler application, I have realized there there are no simple program (there are big & bloated ones…) to enable me to develop C++ applications to run specifically as CGI applications which does small annoying tasks such as extracting usable data from the POST form data. So I am developing a CGI C++ helper library, a very simple but complete library to help anyone rapidly build C++ applications specially to run under a CGI environment. This would include but not limited to, interpretation of the POST form data, outputting special content-type and other header related information, as well as implementation of what I like to call cgiout which would exactly as cout, except would automatically interpret endl< and /n as br so in HTML it would be the next line.

The main idea was for the application to extract the POST data. All the POST data sent to a CGI application is fed into the application through the stdin in the format of

variable1=value1&variable2=value2&variable3=value3...

Which is easily deciphered, but with the library I am making, it would be even simpler almost as easy as in php. Simply if you want to see the value of the variable, call function with the wanted variable name and would return a string of the value. This was the code used to simply make sense of the POST data.

var =input.substr(0,input.find("=",0));
value =input.substr(input.find("=",0)+1,input.find("&",0)-input.find("=",0)-1);
input.erase(0,input.find("&",0)+1);

Very simple and small block of code to extract the variable, value, and the remove the extracted data from the input string which holds the complete POST data. This code block run recursively can extract all the variable=value sets. There are some other small bugs the completed library will take care of but I am not going to say any more about this on this post. I will post a download as soon as I have it working to some degree and get all the GPL announcements on the source files.

Download source