?? writeled.c
字號:
#include <stdio.h>#include <string.h>#include <malloc.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <signal.h>#include <sys/ioctl.h>#define GET_DATA 0x4800int main(void){ int fd,count; unsigned long rgcon; int *spinfo=(int *)malloc(4); printf("entered main\n"); if((fd=open("/dev/leddrv",O_RDWR))==-1) { perror("open eror"); exit(1); } rgcon=0xffffff20; printf("open ok\n"); if((count=write(fd,(char *)&rgcon,4))!=4) { perror("write error"); exit(1); } printf("write ok\n"); if(ioctl(fd,GET_DATA,spinfo)!=0) { perror("ioctl erreor"); exit(1); } printf("spinfo=%d\n",*spinfo); for(;;); close(fd); return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -