|
本帖最后由 netlabel 于 2015-3-20 17:53 编辑
USBHost 移植成功但是写U盘的时候出问题,求助老大们!!!如下程序能正常读写U盘文件,但是我要将程序中某个数组的数据如:uint_8 data[]={0xff,0xff}保存到U盘XX.TXT应该怎么做?
用UserBuffer指向data好像不行!!
void Main_Write (void)
{
int32_t fdw;
int32_t fdr;
uint32_t tot_bytes_written;
uint32_t bytes_written;
fdr = FILE_Open(FILENAME_R, RDONLY);
if (fdr > 0) {
FILE_Read(fdr, UserBuffer, MAX_BUFFER_SIZE);
fdw = FILE_Open(FILENAME_W, RDWR);
if (fdw > 0) {
tot_bytes_written = 0;
PRINT_Log("Writing to %s...\n", FILENAME_W);
do {
bytes_written = FILE_Write(fdw, UserBuffer, MAX_BUFFER_SIZE);
tot_bytes_written += bytes_written;
} while (tot_bytes_written < WRITE_SIZE);
FILE_Close(fdw);
PRINT_Log("Write completed\n");
} else {
PRINT_Log("Could not open file %s\n", FILENAME_W);
return;
}
FILE_Close(fdr);
} else {
PRINT_Log("Could not open file %s\n", FILENAME_R);
return;
}
} |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|