read.c
来自「Windows设备驱动程序设计 (*.ppt) intoduce about h」· C语言 代码 · 共 24 行
C
24 行
#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#define NUM 64main(){int i,testdev;unsigned char buf[NUM];for(i=0;i<NUM;i++) buf[i] = 1;testdev = open("/dev/testpcidevice",O_RDWR);if ( testdev == -1 ){printf("Cann't open file \n");exit(0);}buf[0] = 0x3c;read(testdev,buf,4);for(i=0;i<5;i++) printf("The No.%d value is :%x\n",i,buf[i]);close(testdev);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?