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){
相关文档:
linux if命令
无论什么编程语言都离不开条件判断。SHELL也不例外。
if list then
do something here
elif list then
  ......
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 ......
第一部 安装wine
1、这个都不用说了,wiki上的
http://wiki.ubuntu.org.cn/index.php?title=Wine&variant=zh-cn
2、 要是你觉得无聊的话。。
去http://www.winehq.com
去下个1.1.34的编译玩玩
下好了先检查wine的依赖包
代码:
sudo apt-get build-dep wine
安装掉
解压你下的wine
代码: ......
用rpm包安装的MySQL是不会安装/etc/my.cnf文件的,
至于为什么没有这个文件而MySQL却也能正常启动和作用,在点有两个说法,
第一种说法,my.cnf只是MySQL启动时的一个参数文件,可以没有它,这时MySQL会用内置的默认参数启动,
第二种说法,MySQL在启动时自动使用/usr/share/mysql目录下的my-medium.cnf文件,这种说法仅 ......
到最后还是自己解决了,导致该问题的原因是在linux启动到最后出现:
/bin/sh: can't access tty; job control turned off
而出现该错误的原因和解决方法google后有千百种,尝试了很多种都没有帮我解决问题。
下面是我自己的解决方法:
1. vi /etc/inittab 第一行添加
console::sysinit:/etc/init.d ......