emsApplication/applications/WebConfigure/example/cgiDemo/example.cpp

38 lines
923 B
C++
Raw Permalink Normal View History

2024-05-24 12:19:45 +08:00
#include <exception>
#include <iostream>
#include <cgicc/Cgicc.h>
#include <cgicc/HTTPHTMLHeader.h>
#include <cgicc/HTMLClasses.h>
using namespace std;
using namespace cgicc;
int main(int argc,char **argv)
{
try
{
Cgicc cgi;
// Output the HTTP headers for an HTML document, and the HTML 4.0 DTD info
cout << HTTPHTMLHeader() << HTMLDoctype(HTMLDoctype::eStrict) << endl;
cout << html().set("lang", "en").set("dir", "ltr") << endl;
// Set up the page's header and title.
cout << head() << endl;
cout << title() << "GNU cgicc v" << cgi.getVersion() << title() << endl;
cout << head() << endl;
// Start the HTML body
cout << body() << endl;
// Print out a message
cout << h1("Hello, world from GNU cgicc") << endl;
// Close the document
cout << body() << html();
}
catch(const exception& e)
{
// handle error condition
}
return 0;
}