參考 EXAM10 的程序
iCreateDate = MAKE_FILE_DATE( 2013, 3, 1 ); /* 設(shè)置創(chuàng)建日期和時(shí)間 */ iCreateTime = MAKE_FILE_TIME( 15, 39, 20 ); iDIR_WrtTime = MAKE_FILE_DATE( 2013, 3, 1 ); /* 設(shè)置修改日期和時(shí)間 */ iDIR_WrtDate = MAKE_FILE_TIME( 15, 39, 20 ); printf( "為指定文件設(shè)置創(chuàng)建日期和時(shí)間\r\n" ); printf( "Open\r\n" ); strcpy(TarName, "\\NEWFILE.TXT" ); /* 目標(biāo)文件名 */ s = CH376FileOpenPath((uint8_t *)TarName ); /* 打開源文件 */ if ( s == USB_INT_SUCCESS ) { /* 文件讀寫操作等... */ s = CH376DirInfoRead( ); if ( s == USB_INT_SUCCESS ) { buf[0] = (UINT8)iCreateTime; buf[1] = (UINT8)(iCreateTime>>8); CH376WriteOfsBlock( (uint8_t *)&buf[0], STRUCT_OFFSET( FAT_DIR_INFO, DIR_CrtTime ), 2 ); buf[0] = (UINT8)iCreateDate; buf[1] = (UINT8)(iCreateDate>>8); CH376WriteOfsBlock( (uint8_t *)&buf[0], STRUCT_OFFSET( FAT_DIR_INFO, DIR_CrtDate ), 2 ); buf[0] = (UINT8)iDIR_WrtTime; buf[1] = (UINT8)(iDIR_WrtTime>>8); CH376WriteOfsBlock( (uint8_t *)&buf[0], STRUCT_OFFSET( FAT_DIR_INFO, DIR_WrtTime ), 2 ); buf[0] = (UINT8)iDIR_WrtDate; buf[1] = (UINT8)(iDIR_WrtDate>>8); CH376WriteOfsBlock( (uint8_t *)&buf[0], STRUCT_OFFSET( FAT_DIR_INFO, DIR_WrtDate ), 2 ); s = CH376DirInfoSave( ); if ( s == USB_INT_SUCCESS ) { /* 成功修改并保存 */ /* 文件讀寫操作等... */ printf( "Change Success and Save\r\n" ); } CH376FileClose( FALSE ); /* 關(guān)閉文件 */ } mStopIfError( s ); }
結(jié)果顯示: 創(chuàng)建時(shí)間:2013年3月1日今天, 15:39:20 修改時(shí)間:2042年7月10日星期四, 08:19:02
請(qǐng)問這是為什么?。???[Emot]1[/Emot]