Free collection of beautiful vector icons for your web pages.

C++ cross-platform RS232 serial communication library


Serialib is a cross-platform library written in C++.

The library has been tested on Windows and Linux. This project has been developed with Qt Creator and succesfully compile with:


Opening and closing

Write operations

Read operations

Special read/write

IO write

IO read


ASCII table

This first example send a section of the ASCII table on the serial device:

// Connection to serial port
serialib serial;
if (serial.openDevice("/dev/ttyACM0", 115200)!=1) return 1;

// Display ASCII characters (from 32 to 128)
for (int c=32;c<128;c++)

// Close the serial device

This example has been tested with the Arduino TFT terminal:

ASCII table received on the TFT touch screen

IO read/write

This second example set DTR and unset RTS before displaying input pins status:

// Connection to serial port
serialib serial;
if (serial.openDevice("COM1", 115200)!=1) return 1;

// Set DTR and unset RTS

// Loop forever and display pin status
while (1)
    // Read and display the status of each pin (DTR should be 1, RTS should be 0)
    printf ("4-DTR=%d\t", serial.isDTR());
    printf ("7-RTS=%d\t", serial.isRTS());

    printf ("1-DCD=%d\t", serial.isDCD());
    printf ("8-CTS=%d\t", serial.isCTS());
    printf ("6-DSR=%d\t", serial.isDSR());
    printf ("9-RING=%d\n", serial.isRI());


Serialib can be downloaded with one of the following links:

Last update : 01/10/2020