libpobu

A simple collection of functions and classes to facilitate some tasks in C++, without burdening small projects too much.


Home Back Clone

Libpobu

A simple collection of functions and classes to facilitate some tasks in C++, without burdening small projects too much. Create "libpobu.a" with make and use it in your projects by including the header (libpobu.h) and giving the linker the necessary instructions. For example:

g++ test.cpp  -o test -lpobu -L. 

Or more simply:

g++ test.cpp  -o test ../../libpobu.a

For a matter of code readability, I have renamed some data types. Here are some examples:

typedef std::vector<std::string> pobList;
typedef std::vector<pobList> pobTable;
typedef std::string pobString;

Look at the examples folder to get an idea of how to use the library.

Quick example:

#include "../../source/libpobu.h"

int main(int argc, char* argv[] )

{
       pobFile myfile0("test.txt",'w');
       myfile0.write("Hello world 0 \n");
       myfile0.write("Hello world 1 \n");
       myfile0.write("Hello world 2 \n");
       myfile0.append("Hello world 3");
       myfile0.write("Hello world 4 \n");
       myfile0.write("End hello world.");
       myfile0.close();


        pobString r;
        pobFile myfile1("test.txt",'r');
        //r=myfile1.readAll();
        while(myfile1.read(r))
        {
            print(r);
        }

        myfile1.close();




        return 0;
}

Powered by Code, a simple repository browser by Fabio Di Matteo