Information Technology Reference
In-Depth Information
// Get the first entry that isn't a long-file-name entry.
while (a == ATTR_LONG_NAME)
{
(*fHandle)++;
// Retrieve a directory entry and get the attributes.
// The ForceRead parameter is false
// to prevent unnecessary sector reads.
dir = Cache_File_Entry( fo, fHandle, FALSE);
a = dir -> DIR_Attr;
}
}
}
return(dir);
}
Updating an Entry
The Write_File_Entry function accepts a FILEOBJ pointer to a FILE struc-
ture and a pointer to the number of the file's entry in its directory (curEn-
try). The FILE structure's dsk -> buffer member must contain the contents
of the sector to be written, and the dirccls member must contain the num-
ber of the entry's directory cluster. The function calculates the sector to
write to and writes the contents of the buffer to the storage media.
The function calls the SectorWrite function from Chapter 5 and the
Cluster2Sector function from Chapter 8.
byte Write_File_Entry( FILEOBJ fo, word *curEntry)
{
word
ccls;
DISK
*dsk;
byte
offset2;
dword
sector;
byte
status;
// Save the FILE structure's dsk member and directory cluster.
dsk = fo -> dsk;
ccls = fo -> dirccls;
Search WWH ::




Custom Search