f_mkdir( "0 : DATA" );
f_opendir( &dir, "0:DATA" );
res = f_open( &MyFile, "0:DATA/data.txt", FA_OPEN_ALWAYS | FA_WRITE );
bytesWritten = MyFile.fsize;
res = f_lseek( &MyFile, bytesWritten );
res = f_write( &MyFile, adcx, sizeof( adcx ), ( void * ) &bytesWritten );
res = f_close( &MyFile );
pdir[ 0 ] = '\0';
ptxt[ 0 ] = '\0';
sprintf( ( char * ) pdir, "0:DATA%02d", dirnum );
sprintf( ( char * ) ptxt, "0:DATA%02d/%02d.txt", dirnum, txtnum );
f_mkdir( ( const TCHAR * ) pdir );
f_opendir( &dir, ( const TCHAR * ) pdir );
res = f_open( &MyFile, ( const TCHAR * ) ptxt, FA_OPEN_ALWAYS | FA_WRITE );
bytesWritten = MyFile.fsize;
res = f_lseek( &MyFile, bytesWritten );
res = f_write( &MyFile, adcx, sizeof( adcx ), ( void * ) &bytesWritten );
res = f_close( &MyFile );
dirnum++;
txtnum++;
似乎是文件名出了问题,可以下个断点,调试一下看看文件名是什么。
|