Chapter 2. Usage

Table of Contents


This chapter is provided as a basic introduction to the use of the cgixx library. For more complete information, refer to the cgixx reference manual. The examples in this chapter are for demonstration only and may not be fully functional.


CGI headers are generated through the cgixx::header class. The cgixx::header class allows you to control the expiration of content, cookies, and error codes. After the cgixx::header has been initialized, use the get() member method to retrieve the full header string.

#include <cgixx/cgixx.h>
#include <iostream>

int main(int argc, char* argv)
	cgixx::header header;

	// Set the header to expire immediately (or minus one day)

	// Print the header
	std::cout << header.get();

	// Print the simple HTML output
	std::cout <<
		"<HTML><HEAD><TITLE>Test page</TITLE><HEAD>\n"
		"<BODY><H1>Test Page</H1><HR>\n"
		<< std::endl;

	return 0;