Skip to content


Write a Web Site in Pure C++?

Sure, why not. The efficiency should be great (truly said I don’t believe in all those benchmarks that show java being faster than C++). I know that some will say that it is difficult to write a C++ program but well, the same is said about perl and java so lots of people write soft in php, but  most of such programs are unmaintanable.

What to Use for The Core

The core of this web application should be CGI or even better FCGI. FCGI means Fast CGI and CGI means that you can run any program that you want and it, together with a www server like apache, nginx or anything else, will generate some content served by the web server.

For FCGI and C++ there is a library fastcgi++ that will be enough for creating a simple class which should then parse the HTTP request, dispatch it and serve the content.

Additional Libraries

Usually needed libraries for webapps can be divided into below categories:

  • database access
  • image processing
  • logging
  • generating reports

Database Access

For the database access you can use even pure ODBC or wrap this into some other library. The one that looks really great is SOCI. It allowes you to write sql queries in the C++ manner:

int id = ...;
Person p;

sql << "select first_name, last_name, date_of_birth "
       "from persons where id = " << id,
       into(p);

Image Processing

For images the best choose will be the ImageMagick library. Of course there is no problem with using it in a C++ program as the library is written in C++.

Logging

As for logging I don’t like any ready libraries, they are too huge and sometimes too slow for simple logging. Writing such a class for logging is very simple. One public function in that class would be enough for the beginning:

std::string Log::Log ( std::string info )

Generating Reports

Well, this would be the greates problem. Reports should be generated in some formats like: CSV, Excel and PDF. I have no idea what to use, I’ll search for something, test it and write another post here.

No related posts.

Posted in software, web.

Tagged with , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.



Better Tag Cloud