CH375B,請(qǐng)幫忙,謝謝。13971493986

UINT8 USBTestwrite( void ) { UINT8 ii; UINT8 uTemp, jj; UINT8 *pFileTemp; int dwTemp1, dwTemp2; char *pTemp = "/TestUSB.DAT";

printf(" Create USB File = \"%s\" \n", pTemp); strcpy( (char *)mCmdParam.Create.mPathName, pTemp ); /* 新文件名,在根目錄下 */ ii = CH375FileCreate( ); /* 新建文件并打開,如果文件已經(jīng)存在則先刪除后再新建 */ if ( ii != ERR_SUCCESS ) { printf(" Create File fail \n"); return 0x03; } printf(" Write File Now \n"); mCmdParam.ByteWrite.mByteCount = 64; for( ii = 0; ii < 64; ii++ ) mCmdParam.ByteWrite.mByteBuffer[ii] = ii; ii = CH375ByteWrite ( ); { if ( ii != ERR_SUCCESS ) { printf("CH375ByteWrite fail \n"); return 0x05; } } printf(" close File Now \n"); mCmdParam.Modify.mFileSize = 64; mCmdParam.Modify.mFileDate = 0xffff; mCmdParam.Modify.mFileTime = 0xffff; mCmdParam.Modify.mFileAttr = 0xff; CH375FileModify( );

#if 1 mCmdParam.Close.mUpdateLen = 1; /* 自動(dòng)計(jì)算文件長度,以字節(jié)為單位寫文件,建議讓程序庫關(guān)閉文件以便自動(dòng)更新文件長度 */ #endif ii = CH375FileClose( ); if ( ii != ERR_SUCCESS ) { printf(" Close File fail \n"); return 0x06; } strcpy( (char *)mCmdParam.Open.mPathName, "/TestUSB.DAT" ); /* Key文件名固定 */ uTemp = CH375FileOpen( ); /* 打開key文件 */ if ( uTemp != ERR_SUCCESS ) /* 打開key文件失敗 */ { printf("/n Error: Open File Error,uTemp= %x\n ",uTemp); return 0x01; } printf("/n Open File OK\n ");

dwTemp1 = MAX_FILE_LENG;/*上傳的最大文件長度為2M*/ dwTemp2 = 0;/*存放讀取的文件長度*/ pFileTemp = &FILE_DATA_BUF[0];/*Key文件存放緩沖區(qū)*/

dwTemp1 = FILE_DATA_BUF_LEN; while ( dwTemp1 ) { if ( dwTemp1 > MAX_BYTE_IO ) uTemp = MAX_BYTE_IO; /* 剩余數(shù)據(jù)較多,限制單次讀寫的長度不能超過 sizeof( mCmdParam.ByteRead.mByteBuffer ) */ else uTemp = dwTemp1;/* 最后剩余的字節(jié)數(shù) */ mCmdParam.ByteRead.mByteCount = uTemp; /* 請(qǐng)求讀出幾十字節(jié)數(shù)據(jù) */ jj = CH375ByteRead( ); /* 以字節(jié)為單位讀取數(shù)據(jù)塊,單次讀寫的長度不能超過MAX_BYTE_IO,第二次調(diào)用時(shí)接著剛才的向后讀 */ if ( jj != ERR_SUCCESS ) { CH375FileClose( ); printf("CH375ByteRead return Error %d\n", jj); return 0x02; } dwTemp1 -= mCmdParam.ByteRead.mByteCount; /* 計(jì)數(shù),減去當(dāng)前實(shí)際已經(jīng)讀出的字符數(shù) */ dwTemp2 += mCmdParam.ByteRead.mByteCount; for ( jj = 0; jj != mCmdParam.ByteRead.mByteCount; jj++ ) *pFileTemp++ = mCmdParam.ByteRead.mByteBuffer[jj]; /* 將文件轉(zhuǎn)到緩沖區(qū),請(qǐng)注意:此地方可以做進(jìn)一步的優(yōu)化 */

printf( "Reading File, len: 0x%x\n", mCmdParam.ByteRead.mByteCount ); for ( jj = 0; jj != mCmdParam.ByteRead.mByteCount; jj++ ) printf( "File: 0x%x\n", mCmdParam.ByteRead.mByteBuffer[jj] ); if ( mCmdParam.ByteRead.mByteCount < uTemp ) /* 實(shí)際讀出的字符數(shù)少于要求讀出的字符數(shù),說明已經(jīng)到文件的結(jié)尾 */ { printf( "Read File %s Over,the length is 0x%x\n", "/ZYDQ_KEY.DAT", dwTemp2 ); break; } } CH375FileClose( );/*關(guān)閉源文件*/ return 0; }

"/TestUSB.DAT 文件名有小寫字母.不可以


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频