Information Technology Reference
In-Depth Information
// Save the FILE structure's dsk member.
disk = fo -> dsk;
do {
// Save the file's current cluster number.
c2 = fo -> ccls;
// Read the next cluster number from the FAT entry for the current cluster.
if ( (c = FATread(disk, c2)) == FAIL)
error = CE_BAD_SECTOR_READ;
else
{
if ( c >= disk -> maxcls)
{
// The cluster number is greater than the volume's last cluster's number.
// Set a return value but then check to see if the entry is an EOC marker.
error = CE_INVALID_CLUSTER;
}
c2 = LAST_CLUSTER;
if ( c >= c2)
{
// The entry is an EOC marker, so the current cluster is the file's last one.
error = CE_FAT_EOF;
}
}
// The cluster number is valid. Store the new current cluster number.
fo -> ccls = c;
// Quit on finding the desired cluster or on error.
} while (--n > 0 && error == CE_GOOD);
return(error);
}
Search WWH ::




Custom Search