|
// io.c
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
main (){
int fd;
int str[3];
if ((fd=open("/dev/hiddev0",O_RDWR|O_CREAT,0600))<0)
{
perror("open");
exit(1);
}
if (write(fd,str,3)<0)
{
perror("write");
exit(1);
}
}
/dev/hiddev0 是一个usb设备,但不是block设备
运行 gcc -o io io.c 没有提示什么东西
运行 ./io 出现错误 write: Invalid argument
为什么 ?怎么修改?谢谢!! |
|