AXCEL C++ Library

Sorry I haven’t posted in a while. I have been disconnected from the Internet for a month or 2. During that time, I had nothing better to do than to create a C++ library. AXCEL stands for All-purpose Cross-platform C++ Extension Library.

AXCEL C++ Library is hosted at sourceforge: http://sourceforge.net/projects/libaxcel/

AXCEL is a free and open-source C++ library that’s compatible with POSIX
conforming and Windows operating systems. AXCEL includes classes for the following:

* Console I/O and manipulation
* File I/O
* TCP socket communications
* String manipulation
* Multi-threading

In addition, a utility module exports useful functions, some of which are
commonly performed on the command-line such as file manipulation.

Functions and methods from this library:

* Short mnemonic names that do not exceed 6 characters in length
* Non-mixed case names (all lowercase)
* Do not accept more than 3 arguments
* Do not accept pointers to complex structures
* Performs one single operation without a need for preparation

Here’s a few small examples from the library:

/* 
* After accepting user input, the following displays:
* ...-=-=-=-=-=-=-=-Hello, NAME!-=-=-=-=-=-=-=-=-=-...
* where NAME is the user's input
*/
string s(256);
con << "Enter your first name: " >> s;
con << s.prep("Hello, ").cat("!").center(40, "-=").cat("\n");

/*
* The following displays:
* Downloaded 1 MB
* Downloaded 2 MB
* Downloaded 3 MB
* ...
*/
string s("Downloaded 1 MB\n");
for ( ; ; s++) { con << s; delay(200); }

This should be self-explanatory:

#include "axcel/inc/string.h"
#include "axcel/inc/sock.h"
using namespace axcel;

int main() {
   sock server, client;
   string s;
   int a, b;
   server.listen("888", 4);
   server.accept(client);
   client.puts("Enter your name: ");
   client.gets(s.realloc(512));
   client << s.chomp().prep("Hello, ").cat("!").center(40, "-=") << "\r\n";
   client <<
      "Enter a number: " >> a <<
      "Enter another number: " >> b;
   client << "The sum is " << a + b << "\r\n";
   client &lt< "Press enter to quit. . .";
   client.gets(s.realloc(256));
   client.close();
   server.close();
}

One thought on “AXCEL C++ Library

  1. Pingback: AXCEL C++ Library « Jakash3's Blog | Internet blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: