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
相关文档:
在ubuntu中,终止一个进程或终止一个正在运行的程序,一般是通过 kill 、killall、pkill、xkill 等进行。
-------------------------------------------------------------------
先看两个例子:
例子一:结束某个程序,如Firefox
键入命令:
pkill firefox
例子二: 结束某个进程,如find&n ......
cat awk '{print}'
cat -s awk '{blank = NF == 0 ? ++blan ......
2.1.2 是否通用
有些单片机厂家也给客户提供了大量的驱动程序,比如USB
HOST驱动程序,这可以让客户很容易就可以在它的上面编写程序读写U盘。但是客户写的这些程序,只能在这种芯片、这个驱动程序上使用;更换另一种芯片
后,即使芯片公司也提供了驱动程序,但是接口绝对不一样,客户又得重新编写应用程序。
基于操作 ......
Linux软件包,常见的格式包括有rpm,deb,tar,gz,tgz,zip,bz2等等。几乎每个linux软件都会提供tar的格式的软件包,因为这种格式的软件包任何版本的linux都支持,所以大家至少要了解tar和rpm的使用方法。至于deb可用alien工具转换成tgz或rpm方式。bz2可用bunzip2解包即可。
一、RPM文件的安装
RPM 是RedHat Package ......
一 三种类型的套接字:
1.流式套接字(SOCKET_STREAM)
提供面向连接的可靠的数据传输服务。数据被看作是字节流,无长度限制。例如FTP协议就采用这种。
2.数据报式套接字(SOCKET_DGRAM)
提供无连接的数据传输服务,不保证可靠性。
3.原始式套接字(SOCKET_RAW)
......