test.c~

来自「linux下hpi口驱动程序」· C~ 代码 · 共 38 行

C~
38
字号
#include <stdio.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h>

main()

{

int testdev;

int i;

int buf[10]={1,2,3,4,5,6,7,8,9,0};


testdev = open("/dev/HPI",O_RDWR);

if ( testdev == -1 )

{

printf("Cann't open file ");

exit(0);

}
if(write(testdev,buf,10))    printf("write ok\n");
close(testdev);

}

⌨️ 快捷键说明

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