test.c
来自「linux下的字符设备驱动代码」· C语言 代码 · 共 26 行
C
26 行
#include <stdio.h>int main(){ char *source="1234567890"; char destination[12]; destination[11]='\0'; int fd=open("/dev/VFIFO",2); if(fd==-1){ printf("file open fail!!\n"); return 0; } write(fd,source,10); close(fd); fd=open("/dev/VFIFO",2); if(fd==-1){ printf("file open fail!!\n"); return 0; } read(fd,destination,10); close(fd); printf("The data translated by the virtual device VFIFO is: %s\n",destination); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?