易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux下串口通信

1.         打开串口
       与其他的关于设备编程的方法一样,在Linux下,操作、控制串口也是通过操作起设备文件进行的。在Linux下,串口的设备文件是/dev/ttyS0或/dev/ttyS1等。因此要读写串口,我们首先要打开串口:
       char *dev  = "/dev/ttyS0"; //串口1
       int    fd = open( dev, O_RDWR );
        //| O_NOCTTY | O_NDELAY      
       if (-1 == fd)   
       {                  
              perror("Can't Open Serial Port");
              return -1;       
       }    
       else 
              return fd;
      
2.         设置串口速度
       打开串口成功后,我们就可以对其进行读写了。首先要设置串口的波特率:
       int speed_arr[] = { B38400, B19200, B9600, B4800, B2400, B1200, B300,
                      B38400, B19200, B9600, B4800, B2400, B1200, B300, };
int name_arr[] = {38400,  19200,  9600,  4800,  2400,  1200,  300, 38400, 
                            &n


相关文档:

我的Linux学习笔记

http://wiki.chinaunix.net/index.php/Linux
--------------------获得帮助 : man和info使用  --------------------
  因为同一个命令可能属于几个section,如open:就既有命令的open,程序函数的open,等等。每一个section有一个section号。  
  man   -aw   <命令>&n ......

20 Linux Server Hardening Security Tips

Securing your Linux server is important to protect your data, intellectual property, and time, from the hands of crackers (hackers). The system administrator is responsible for security Linux box. In this first part of a Linux server security series, I will provide 20 hardening tips for default inst ......

Linux之Ubuntu篇(一)gcc和g++


这是本人的处男作品,看完的人要对本人负责啊!
gcc和g++都是GNU(组织)的一个编译器。 
gcc与g++的对比
误区一:gcc只能编译c代码,g++只能编译c++代码
两者都可以,但是请注意:
1.后缀为.c的,gcc把它当作是C程序,而g++当作是c++程序;后缀为.cpp的,两者都会认为是c++程序,注意,虽然c++是c的超集,但是两者 ......

ARM+Linux中无法响应ctrl+c是怎么回事

到最后还是自己解决了,导致该问题的原因是在linux启动到最后出现:
/bin/sh: can't access tty; job control turned off
而出现该错误的原因和解决方法google后有千百种,尝试了很多种都没有帮我解决问题。
下面是我自己的解决方法:
1. vi /etc/inittab 第一行添加
    console::sysinit:/etc/init.d ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号