Information Technology Reference
In-Depth Information
// Save the file's name from the FILE structure.
for (index = 0; index < FILE_NAME_SIZE; index ++)
{
name[index] = fo -> name[index];
}
if (error == CE_GOOD)
{
*fHandle = 0;
// Find an empty entry in the directory.
if (FindEmptyEntries(fo, fHandle))
{
// Store the file's data in the entry.
if ((error = PopulateEntries(fo, name ,fHandle)) == CE_GOOD)
{
// Allocate a cluster to the file.
error = CreateFirstCluster(fo);
}
}
else
{
error = CE_DIR_FULL;
}
}
return(error);
}
Deleting a File
To delete an existing file in the FAT16 file system, the storage media's host
must do the following:
1. Search the file's directory for the entry containing the name of the file to
delete.
2. Save the cluster number from the file's directory entry.
3. Mark the directory entry as deleted by storing E5h in the entry's first byte.
Search WWH ::




Custom Search