Information Technology Reference
In-Depth Information
4. Examine the FAT entry for the saved cluster number. If the entry isn't an
EOC marker, save the cluster number and store 0000h in the entry to mark
it as available.
5. Repeat step 4 until finding an EOC marker. Replace the EOC marker
with 0000h.
The FAT_erase_cluster_chain function accepts a cluster number (cluster)
and a pointer to a DISK structure (dsk) and stores 0000h in all FAT entries
in the chain beginning with the passed cluster number. The function calls
the FATread and FATwrite functions from Chapter 8.
byte FAT_erase_cluster_chain (word cluster, DISK *dsk)
{
word c;
word c2;
enum _status {
Good,
Fail,
Exit
} status;
status = Good;
// Valid cluster numbers start at 2.
if (cluster == 0 || cluster == 1)
{
status = Exit;
}
else
{
while (status == Good)
{
// Get the FAT entry for the passed cluster number.
if (c = FATread(dsk, cluster)) == FAIL)
status = Fail;
Search WWH ::




Custom Search