2012年4月14日

自己写的shell程序 多层管道、重定向、后台、命令历史

摘要: #include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<fcntl.h>#include<string.h>#include<stdbool.h>#include<signal.h>#include <readline/readline.h>#include <readline/history.h>//#include<errno.h>//#include<sys/stat.h>#define M 阅读全文

posted @ 2012-04-14 18:45 wps712 阅读(652) 评论(0) 推荐(0) 编辑

键盘上键的ASCII码

摘要: 字母 A 到 Z 和标准数字 0 到 9A(65) B(66) C(67) D(68) E(69) F(70) G(71) H(72) I(73) J(74) K(75) L(76) M(77) N(78) O(79) P(80) Q(81) R(82) S(83) T(84) U (85) V(86) W(87) X(88) Y(89) Z(90) 0(48) 1(49) 2(50) 3(51) 4(52) 5(53) 6(54) 7(55) 8(56) 9(57) 数字键盘上的键数字键盘0(96) 数字键盘1(97) 数字键盘2(98) 数字键盘3(99) 数字键盘4(100) 数字键盘5 阅读全文

posted @ 2012-04-14 10:19 wps712 阅读(4302) 评论(0) 推荐(0) 编辑

实现类似于shell中按“向上”,“向下”箭头的功能————readline库

摘要: [转载] 正确编译使用readline库The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes additional functions to maintain a list of previously-entered com 阅读全文

posted @ 2012-04-14 09:58 wps712 阅读(1227) 评论(0) 推荐(0) 编辑

open创建文件后,再读取出现Permission denied错误

摘要: 函数 open(char *pathname, int flag, mode_t mode),当flag 指定有O_CREAT并忽略mode参数,在下次打开文件时,可能会提示没有权限之 类的错误原因:这样创建的文件权限是随机的,如果要指定创建的文件权限,就需要填写 mode 参数,这个参数是指定文件权限的,文件的权限分3组9位(rwx rwx rwx--对应用户,用户所在组,其它用户), mode 的值用4位表示,为3每组权限的和值。另外还有一个 umask 函数,这个函数是权限屏蔽,和 mode值 正好相反。 阅读全文

posted @ 2012-04-14 00:53 wps712 阅读(2305) 评论(0) 推荐(0) 编辑

导航