#include <termios.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> int main( void ) { int fd; struct termios termios_p; speed_t speed; fd = open( "/dev/ser1", O_RDWR ); tcgetattr( fd, &termios_p); /* * Get input baud rate */ speed = cfgetispeed( &termios_p); printf( "Input baud: %ld\n", speed ); close( fd ); return EXIT_SUCCESS; } # ./a.out Input baud: -1077937236 为什么找不到/dev/ser1 ??用ls 看不到? # ls -a /dev|grep ser # 不懂中。。。 负数代表什么意思? 发现并没有/dev/ser1这个设备 现在运行结果不同了。可能是我贴错程序了。SORRY!!!! 根据上面的程序。 结果: Input baud: 4096
晕了。。?? |