Read serial data using C++ (in Linux)

I am using non blocking:

Essentially that serial coms code was not written by me but rather found by google.

To use it I did the following:

#include "./include/serial.h"
#include <string.h>

int main(int argc, char** argv) {


	char xd= 'a';

	Serial port;
	
	port.dev = "/dev/ttyUSB0";

	port.baud=9600;
	port.dataBits = 8;
        port.blocking = 1;
	
	int result = port.initPort();

        
	printf("Init returned: %i\n", result);


    
	while (result != -1) {

	xd = port.getChar();
        if (xd != 'p') {printf("%c", xd);}
	
			
			}

	port.closePort();			
	return -1;
}