概述
/**
******************************************************************************
* @file dosfsTest.c
* @author Daniel_Lee
* @version V1.0
* @date 2013.7.15
* @brief This is a test of using dosfs.
******************************************************************************
**/
/* Includes ------------------------------------------------------------------*/
#include "vxWorks.h"
#include "iv.h"
#include "intLib.h"#include "sysLib.h"
#include "logLib.h"
#include "dosfsLib.h"
#include "ioLib.h"
#include "stdio.h"
int fd,bytes = 0, length = 0;
unsigned char buf[64] = "Hello,I'm testing the file system";
unsigned char revBuf[64] = {0};
/*fd = creat("/D/my.txt",O_RDWR);
if(fd == -1){
logMsg("error: creat file failedrn",0,0,0,0,0,0);
return ERROR;
}*/
fd = open("/D/my.txt",O_RDWR,0);
if(fd == -1){
logMsg("error: open file failedrn",0,0,0,0,0,0);
return ERROR;
}
bytes = write(fd,buf,sizeof("Hello,I'm testing the file system"));
logMsg("write %d bytes datarn",bytes,0,0,0,0,0);
if(bytes != sizeof("Hello,I'm testing the file system")){
logMsg("error: write %d bytes datarn",bytes,0,0,0,0,0);
close(fd);
return ERROR;
}
close(fd);
fd = open("/D/my.txt",O_RDWR,0);
if(fd == -1){
logMsg("error: open file failedrn",0,0,0,0,0,0);
return ERROR;
}
bytes = read(fd,revBuf,sizeof(revBuf));
logMsg("read %d bytes datarn",bytes,0,0,0,0,0);
revBuf[9] = '