📄 fat16finddirentry.c
字号:
#ifndef _FAT_DEFINE
#include "FAT.c"
#endif
BYTE FAT16FindDIREntry(CHAR *DirName);
BYTE FAT16FindDIREntry(CHAR *DirName)
{
xdata BYTE i,j,m;
xdata CHAR temp[27];
xdata DWORD Sector;
xdata struct FATClusterStr ReadCluster;
if (FAT.CurrentDirectory==FAT.RootClus) //根目录
{
Sector=FAT.CurrentDirectory;
for(m=0;m<FAT.RootSectors;m++)
{
StorageMedia.ReadSector(Sector++,DiskBuffer);
for (i=0;i<16;i++)
{
if (sDIR[i].Attr&FAT_ATTR_VOLUME_ID) continue; //如果是卷标则跳过
if (sDIR[i].Name[0]==0xe5||sDIR[i].Name[0]==0x00) continue; //空目录项跳过
for(j=0;j<11;j++)
temp[j]=sDIR[i].Name[j];
temp[j]=0;
if (strcmp((const char *)DirName,(const char *)temp)==0) return(i);
}
}
}
else
{
ReadCluster.Cluster=FAT.CurrentDirectory;
ReadCluster.SecOffset=0;
while(ReadCluster.Cluster!=FAT_CLUSTER_END16)
{
FATReadCluster(&ReadCluster,DiskBuffer);
for (i=0;i<16;i++)
{
if (sDIR[i].Attr&FAT_ATTR_VOLUME_ID) continue; //如果是卷标则跳过
if (sDIR[i].Name[0]==0xe5||sDIR[i].Name[0]==0x00) continue; //空目录项跳过
for(j=0;j<11;j++)
temp[j]=sDIR[i].Name[j];
temp[j]=0;
if (strcmp((const char *)DirName,(const char *)temp)==0) return(i);
}
}
}
return(i);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -