Information Technology Reference
In-Depth Information
else
// The entry is in a cluster's first sector
// AND the entry's cluster isn't the first one in the directory
// AND it's not the root directory.
// Get the next cluster number.
numofclus = 1;
// To find the cluster containing curEntry,
// get the directory's cluster numbers from the FAT until reaching the
// cluster specified by numofclus or the directory's last cluster.
// On entering the loop, ccls = the passed dsk -> dircclus member.
while (numofclus)
{
// Read the next cluster number from the current cluster's FAT entry.
ccls = FATread(dsk, ccls);
if (ccls >= LAST_CLUSTER)
// There is no next cluster.
break;
else
numofclus--;
}
}
} // End: read a cluster number from the FAT.
// We have a cluster number for the entry, either retrieved from the FAT
// or obtained from the passed FILE structure.
// If ccls is an EOC marker (LAST_CLUSTER code),
// the directory doesn't have as many clusters as we thought. We can't get the entry.
if (ccls < LAST_CLUSTER)
{
// The current cluster isn't the last one in the file.
// We need to read a sector from the media.
// Store the cluster number in the FILE structure.
fo -> dirccls = ccls;
Search WWH ::




Custom Search