有人可以建议我用于串口通信的c ++库,它可以在x86和x86_64版本的OS上运行吗?我使用过Java SerialIO但它在x86_64版本上崩溃了。
答案 0 :(得分:2)
如果你想要c ++,那么QextSerialPort就是你的选择。
答案 1 :(得分:1)
在Linux上,也许,你会尝试“termios”
#include <termios.h>
#include <unistd.h>
int tcgetattr(int fd, struct termios *termios_p);
int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
int tcsendbreak(int fd, int duration);
int tcdrain(int fd);
int tcflush(int fd, int queue_selector);
int tcflow(int fd, int action);
void cfmakeraw(struct termios *termios_p);
speed_t cfgetispeed(const struct termios *termios_p);
speed_t cfgetospeed(const struct termios *termios_p);
int cfsetispeed(struct termios *termios_p, speed_t speed);
int cfsetospeed(struct termios *termios_p, speed_t speed);
答案 2 :(得分:1)
您可以使用boost :: asio
的串口接口http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/overview/serial_ports.html