Information Technology Reference
In-Depth Information
else
{
a = dir->DIR_Attr;
// Mark the entry as deleted.
dir->DIR_Name[0] = DIR_DEL;
// Save the number of the entry's first cluster.
clus = dir->DIR_FstClusLO;
// Write the revised directory entry to delete the file.
if (status != CE_GOOD || !(Write_File_Entry( fo, fHandle)))
status = CE_ERASE_FAIL;
else
{
if (EraseClusters)
{
// Erase the FAT entries for the file's clusters.
status =
((FAT_erase_cluster_chain(clus, disk)) ? CE_GOOD : CE_ERASE_FAIL);
}
}
} // End: a not empty, not deleted entry was returned
} // End: a not empty entry was returned
return (status);
}
Opening a File
The FILEopen function performs several actions to prepare a file for reading
or writing. The function retrieves a file's directory entry, copies information
from the entry into a FILE structure, initializes other members of the FILE
structure, reads the file's first sector into the file structure's dsk -> buffer
member, and sets the file structure's FLAGS.write member to indicate
whether the file is open for reading or writing.
Search WWH ::




Custom Search