急求高手帮忙解决!!!我写了一个小程序,功能是在Linux(fedora 7)操作系统下,通过USB读卡器,读、写SD卡某个sector上的512字节的数据,如果能正确写入,会有相应的响应数据,程序如下:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/#define_GNU_SOURCE#include#include#includetypes.h>#include#include#include#includeintmain(void){intfd,num,loop,tt,i;unsignedcharwriteBuf[512]={0};intoffset=0x50000;//打开fd=open("/dev/sda1",O_RDWR|O_DIRECT);//fd = open("/media/SD CARD/system.txt",O_RDWR);if(fd==-1){printf("can't open the device by device mode !\n");return-1;}//设置//fcntl(fd,F_SETFL,O_DIRECT);//写入数据内容memcpy(writeBuf,"\x55\xAA\xAA\x55",4)
...
继续阅读
(33)