?? optestchar.c
字號:
/*****************************************************************************
版 權:網域時代
部 門:研發部
創建日期:2007年12月25日
簡 述:簡單字符型驅動的測試程序,測試ioctl
文 件 名:charDrv.c
創 建 者:劉明
******************************************************************************/
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/select.h>
#define DATA_NUM (10)
#define OK (0)
#define ERROR (-1)
int main(int argc, char *argv[])
{
int fd, i;
fd_set fdset;
char buf[DATA_NUM], tmp[DATA_NUM];
fd = open("/dev/testchar", O_RDWR);
if(-1 == fd)
{
printf("open file error\r\n");
}
while(1)
{
read(fd, buf, DATA_NUM);
sleep(1);
write(fd, buf, DATA_NUM);
sleep(1);
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -