Serial communication in C++