【文件属性】:
文件名称:linux 实验5 设备管理
文件大小:1KB
文件格式:RAR
更新时间:2012-01-02 02:46:27
设备管理 linux
#include
#include
#include
#include
#include
main()
{
int testdev;
int i ;
char buf[50]="pear to dev! ";
printf("the program tt is running!!\n");
testdev = open("/dev/test",O_RDWR);
if(testdev==-1)
{
printf("can't open file!\n ");
exit(0);
}
write(testdev,buf,50);
printf("write \"%s\"\n",buf,50);
strcpy(buf,"apple to dev! ");
printf("the buffer is changed to \"%s\"\n",buf,50);
read(testdev,buf,50);
printf("read from dev is \"%s\"\n",buf);
close(testdev);
}
【文件预览】:
实验5设备管理
----my_dev.c(2KB)
----dev_test.c(570B)