Information Technology Reference
In-Depth Information
// Increment the sector number.
fo -> sec++;
// The sector number (sec) should be a value between 0 and SecPerClus - 1.
// If sec = SecPerClus, the sector is the first sector in a new cluster.
if (fo -> sec == dsk -> SecPerClus)
{
// Get the next cluster in the file and start in the cluster's first sector.
fo -> sec = 0;
error = FILEget_next_cluster( fo, 1);
}
if (error == CE_GOOD)
{
// Get the sector number of the current cluster, which may have changed.
l = Cluster2Sector(dsk,fo -> ccls);
// Add the number of the current sector within the cluster.
l += (word)fo -> sec;
// Read the sector's data.
if (SectorRead( l, dsk -> buffer) != sdcValid)
error = CE_BAD_SECTOR_READ;
}
} // End: load new sector
if (error == CE_GOOD)
{
// A sector's data is in the DISK structure's buffer member.
// Copy a byte from the specified offset (pos) in the DISK structure's buffer
// to the dest buffer.
*(char *)dest = RAMread(dsk -> buffer, pos++);
Search WWH ::




Custom Search