incu or ++Unix

Posted 2000-12-19 12:00. Tagged , .

Please note that this post is 23 years old. The information herein may be outdated.

Unix facilities for C++ programmers

The aim of ++Unix is to allow C++ programs to use Unix facilities, such as sockets, whose interface includes a lot of pointers and other low-level stuff, and might vary on different kinds of Unix, in a nice, simple and consistent way.

One of the goals: There should be no need for preprocessor conditionals (#if) other than as include guards in a C++ programs that uses ++Unix.


Stream out to syslog as simply as to any ostream. Almost.

#include <incu/log.hh>

main(int argc, char* argv[]) {
      incu::Log::addDevice(new incu::SysLog(argv[0]));
      incu::Log::addDevice(new incu::StreamLog(clog));

   Log() << "A message";

   try { ... }
   catch(const exception &err) {
      Log() << "Something went wrong: " << err;


A pipe created in an object. Really just a constructor / destructor pair for convenience.


Some classes to help out in using sockets. A client looks basically like this:

    incu::SockaddrIn addr;

    incu::Socket socket(PF_INET, SOCK_STREAM, "tcp");

    ifstream in(socket.fd());
    ofstream out(socket.fd());



Contains the classes TimeVal, which is just a constructor for struct timeval, and Time which works like a time_t, but more convenient.

The following will print the current time in a user-friendly format:

    cout << "Time is " << Time() << endl;


Mainly used by the other parts of incu, a c_error is thrown when something goes wrong the errno way.


This post is 23 years old, comments are disabled.