#include #include #include using namespace mt4cpp; int main() { try { SerialPort s("/dev/ttyUSB1", boost::chrono::milliseconds(50) ); //SerialPort s("COM34", boost::chrono::milliseconds(50) ); std::vector in = s.read_n(3); //read 3 bytes or timeout std::cout << "read " << in.size() << " bytes " << std::endl; } catch(std::exception& e) { std::cerr << e.what() << std::endl; } return 0; }