当前位置:首页 » 编程博文
开发技术指南» 文章正文
    引言: 3. Program Examples 示例程序
 

 

    摘要:上周有书商联系我,有意出版一本eclipse开发方面的书籍,这类书籍还是国内出版界的空白,国外也就只出了一本<eclipse in action>。我虽从没写过书,也略知写书的辛苦与报酬低少,然而能做些有意义的新鲜事,我当然是乐而为之。对于我样一个水平低下的程序民工来说,写这本书是很具挑战性的,很怕书出来以后,无人问津,或错误百出,浪费国家的纸张。这类计算机书在市场上真是多如牛毛,我不希望成为其中......
 ·用sql创建数据库    »显示摘要«
    摘要:用sql创建数据库 首先说说怎么用sql语句创建数据库,创建数据库的语句有如下几种: 1. create table(创建新表) 2. create index(增加索引) 3. drop index(删除索引) 4. constraint(约束语句) 5. alter table(修改表) 6. drop table(删除表) create table语句: 在数据库中生成新表,表中字段的......


Linux 串口编程HOWTO 中英文简体对照 beta 版 (续)
3.    program examples 示例程序

see the comments in the code for explanation of the use of the different input modes. i hope that the code is understandable. the example for canonical input is commented best, the other examples are commented only where they differ from the example for canonical input to emphasize the differences. 【程序编程相关:内容管理系统的设计和选型

all examples have been derived from miniterm.c. the type ahead buffer is limited to 255 characters, just like the maximum string length for canonical input processing (<linux/limits.h> or <posix1_lim.h>). 【推荐阅读:世界上发现首例PHP病毒

don´t forget to give the appropriate serial ports the right permissions (e. g.: chmod a+rw /dev/ttys1)! 【扩展信息:也谈绑定dropdownlist(3)

the descriptions are not complete, but you are encouraged to experiment with the examples to derive the best solution for your application.

所有的示例来自于 miniterm.c. the type ahead 缓存器限制在 255 字节的大小, 这与标准输入(canonical input)进程的字符串最大长度相同 (<linux/limits.h> 或 <posix1_lim.h>).

代码中的注释解释了不同输入模式的使用以希望这些代码能够易于理解.标准输入程序的示例做了最详细的注解, 其它的示例则只是在不同于标准输入示例的地方做了强调.

叙述不是很完整, 但可以激励你对这范例做实验, 以延生出合于你所需应用程序的最佳解.

不要忘记赋予串口正确的权限 (也就是: chmod a+rw /dev/ttys1)!

3.1. canonical input processing 标准输入模式

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h>

#include <termios.h>

#include <stdio.h>

/* baudrate settings are defined in <asm/termbits.h>, which is included by <termios.h> */

// 波特率的设置定义在 <asm/termbits.h>. 包含在 <termios.h> 里

#define baudrate b38400      

/* change this definition for the correct port */

// 定义您所需要的串口号

#define modemdevice "/dev/ttys1"

#define _posix_source 1 /*posix compliant source posix系统兼容*/

#define false 0

#define true 1

volatile int stop=false;


...   下一页
 ·python是近期学习的主要内容。    »显示摘要«
    摘要:感觉python是一个很有希望的语言。 对于一个脚本的掌握是一个开发人员必备的素质。 现在的开发人员基本上看重的是一个可以编译语言的使用,对于脚本的使用不是很重视根据我的理解,脚本更加能够体现计算机处理事务的灵活性和结构化。 不过对于现状的改变可能也不是立即可以生效的,还是需要开发人员的不停的努力。 我估计python是脚本语言中比较好的一个,虽然tcl也是使用的非常多。不过tcl的代码可......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE