#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這個設備
現在運行結果不同了??赡苁俏屹N錯程序了。SORRY?。。?!
根據上面的程序。
結果:
Input baud: 4096
暈了。。??