test2.c

来自「s3c2410」· C语言 代码 · 共 27 行

C
27
字号
#include <stdio.h> 
#include <stdlib.h> 
#include <unistd.h> 
#include <sys/ioctl.h> 
#include <fcntl.h>

int main(int argc, char **argv) 
{   
int fd;
int iRet=0; 
int i=0;
unsigned char buf[1]={0};

fd = open("/dev/iic", O_RDWR ); 
if (fd < 0) 
{ 
   perror("can not open device led"); 
   exit(1); 
} 

iRet=read(fd,buf,1); 
printf("buf is %d\n",buf[0]);
close(fd); 
return 0; 
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?