Information Technology Reference
In-Depth Information
// Save the offset to begin reading from within the current sector,
// the offset to read from within the file, and the file's size.
pos = fo -> pos;
seek = fo -> seek;
size = fo -> size;
// Get the sector number of the file's current cluster.
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;
// Read from the file until finished or an error.
while (error == CE_GOOD && temp > 0)
{
if (seek == size)
// It's the end of the file.
error = CE_EOF;
else
{
// If we've reached the end of a sector, load another sector.
if (pos == SDC_SECTOR_SIZE)
{
// Reset the offset within the sector.
pos = 0;
Search WWH ::




Custom Search