Linux程序设计 终端
对终端进行读写
在编写程序时,我们往往需要从终端读入数据。一种情况是需要连续地读入用户键入的选择项,这往往出现在数据库程序中。程序员往往会使用
getchar
函数来读取数据,继而判断输入的数据是否有效,从而做出反应。其实如此做带有很大的风险,一个实例程序如下
#include <stdio.h>
char *menu[] = {
"a - add new record",
"d - delete record",
"q - quit",
NULL
};
int getchoice(char *choices[]){
int chosen = 0;
int selected;
char **option;
do {
option = choices;
while(*option){
printf("%s\n", *option);
option++;
}
selected = getchar();
option = choices;
while(*option){
相关文档:
摘要:从老牌的桌面端的Fedora和Debian,到日渐流行Ubuntu;从节省空间的Puppy Linux,到功能强大的红帽Linux企业版(RHEL),我们的开源专家将告诉你哪个是你最需要的。
【51CTO.com独家特稿】当你对别人说,“我要买辆车。”他马上就会问你:“什么车?”福特、丰田、还是本田?是双门跑车、小轿车 ......
http://wiki.chinaunix.net/index.php/Linux
--------------------获得帮助 : man和info使用 --------------------
因为同一个命令可能属于几个section,如open:就既有命令的open,程序函数的open,等等。每一个section有一个section号。
man -aw <命令>&n ......
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 ......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
在我们国内,不少
Linux
的先行者都以失败而告终,现在,他们在哪里?怎么不出来说话了?但是,这些先行者想告诉我们什么呢?你想知道吗?
搞 ......