Linux 下getch()和getche()
Linux下getch()和getche()
I would recommend never mixing input techniques in a program. Don't mix fgets() or scanf() with getchar(). Don't mix any standerd C library input function with a non-standard function that bypasses the C stream mechanism, be that getch(), getche(), bioskey(), or anything else. Note that these functions do not read from stdin, they read from a hardware keyboard, which is not the same thing.
Functions like getch() and getche() haven't been incorporated into the C standard because not all host systems provide ways to turn off input buffering. Thus compilers include these as common extensions wherever possible.
It is worth pointing out that writing Standart C (or Standart POSIX or whatever) is not always useful or desirable. It is up to the programmer to decide when and whether the benefits of sticking to any particular standards are worth their costs. But in order to make such a decision (and execute it), information *about* those standards is very important.
希望大家能够写出自己的getch() or getche()。
以上是在网站http://bytes.com上的摘录,链接为http://bytes.com/topic/c/answers/476130-getch-getche
相关文档:
现在嵌入式也玩多核了。
利用./mpstat -P ALL 1 100 可以来查看cpu的使用情况。
这个是转的一个例子:
在多CPU的趋势越来越大了. 有时候为了更好地操作机器, 需要将某个进程绑定到具体的CPU上去. 下面给出了一个进程绑定到具体的CPU上去的一个例子.
view plaincopy to clipboardprint?
···&midd ......
PHP在运行的时候,直接kill掉,有肯能造成数据的丢失。幸好php模块,有针对signal的处理。
处理方式,首先检查有没有安装 PCNTL 模块
然后可以在一个包含文件中,添加以下代码
global $exitFlag;
$exitFlag = false;
// 增加linux信号量处理
if (DIRECTORY_SEPARATOR != '\\') {
pcntl_signal(SI ......
我这里说的ioctl函数是在驱动程式里的,因为我不知道更有没有别的场合用到了ioctl,
所以就规定了我们讨论的范围。为什么要写篇文章呢,是因为我前一阵子被ioctl给搞混
了,这几天才弄明白他,于是在这里清理一下头脑。
  ......
最近在维护论坛,论坛的构建是linux nginx+php5.3+mysql5.1。最近一段时间老是出现问题,刚开始由于php版本以及设置的问题还有以前老版本留下的问题,使得论坛老被挂马,找了一个星期的问题,各处都补漏了一下的!php也升级了一下!
  ......
一 三种类型的套接字:
1.流式套接字(SOCKET_STREAM)
提供面向连接的可靠的数据传输服务。数据被看作是字节流,无长度限制。例如FTP协议就采用这种。
2.数据报式套接字(SOCKET_DGRAM)
提供无连接的数据传输服务,不保证可靠性。
3.原始式套接字(SOCKET_RAW)
......