linux下按下键退出while循环(类似于_kbhit)
	
    
    
	#include <stdio.h> 
#include <sys/select.h>
#include <termios.h>
#include <unistd.h>
#include <ctype.h>
#define STDIN     0
int main()
{
    struct timeval tv = {0,0};
    struct termios term , termbak;
    char   ch;
    fd_set    fd;
    
    FD_ZERO(&fd);
    FD_SET( STDIN ,&fd);
  tcgetattr(STDIN, &term);
  termbak = term;
    term.c_lflag &= ~(ICANON|ECHO);
    tcsetattr(STDIN, TCSANOW, &term);    
    while(1)
    {
        FD_ZERO(&fd);
        FD_SET( STDIN ,&fd);
        if(   1 == select( STDIN+1,&fd,NULL,NULL,&tv) 
             && 1 == read( STDIN , &ch , 1 ) 
             && 'q' == tolower(ch) )
            break;
        putchar('.');fflush(stdout);
        usleep(100000);
    }
    
    tcsetattr(STDIN,TCSANOW,&termbak);
    
    return 0;
}
转载自:http://topic.csdn.net/u/20100115/10/7ec685ee-27ef-4b03-b184-ce0a1e728cde.html
    
     
	
	
    
    
	相关文档:
        
    
    名称:cat 
使用权限:所有使用者 
使用方式:cat [-AbeEnstTuv] [--help] [--version] fileName 
说明:把档案串连接后传到基本输出(萤幕或加 > fileName 到另一个档案) 
参数: 
-n 或 --number 由 1 开始对所有输出的行数编号 
-b 或 --number-nonblank 和 -n 相似,只不过对于空白行不编号 
-s 或 --squeez ......
	
    
        
    
    1、将驱动源码放在/drivers/char/下
 
2、修改drivers/char/Kconfig文件,添加以下内容:
config My_Buttons
        tristate "My_Buttons test"
        depends on ARCH_S3C2440
        default y if ARCH_S3C2 ......
	
    
        
    
    一.Linux进入与退出系统
进入Linux系统:
必须要输入用户的账号,在系统安装过程中可以创建以下两种帐号:
  1.root–超级用户帐号(系统管理员),使用这个帐号可以在系统中做任何事情。
  2.普通用户–这个帐号供普通用户使用,可以进行有限的操作。
  一般的Linux使用者均为普通用户,而系统管理 ......
	
    
        
    
    
GNU glibc提供一个对printf的扩展,直接printf("%m"),可以输出标准的错误信息,例如下面:
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
int main()
{
         ......