日期:2014-05-16 浏览次数:21045 次
int fd; struct termios options; fd = open("/dev/ttyAMA0", O_RDWR | O_NOCTTY); tcgetattr(fd, &options); tcsetattr(fd,TCSANOW,&options);
options.c_cflag |= (CLOCAL | CREAD); tcflush( fd , FLUSHMETHOD);
------解决方案--------------------
或者用tcflush(fd,TCIOFLUSH);