📄 test.c
字号:
#include <sys/ioctl.h>#include <unistd.h>#include <stdio.h>#include <fcntl.h>#define DEVICE_AAA "/dev/flash"int main(){ int ret; int fd; char buf[20]; char c[4]; int fileno; //The No. of the file being accessed, /******************************************* The file No. assignment:0~14 Chen Dahong15~18 Zhoutong19~29 Li Yangchun *********************************************/ unsigned long para; //This parament has no use c[0]=c[1]=c[2]=c[3]=0xff; fd=open("/dev/flash",O_RDWR); printf("fd=%d\n",fd); ioctl(fd,30,¶); //before access file in flash, input the number ret=write(fd,"UPDATEFIRMWARE",14); // printf("ret=%d\n",ret); write(fd,c,4); // printf("ret=%d\n",ret); return 0; for(;;){ int r; r=read(fd,buf,5); for(ret=0;ret<r;ret++)printf( "%x ",buf[ret]); printf(" r= %d\n",r); if(r<5)break; }return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -