Information Technology Reference
In-Depth Information
else
{
// A file was found.
// Initialize FILE structure members.
fo -> seek = 0; // Byte offset in the file.
fo -> ccls = fo -> cluster; // The current cluster = the file's first cluster.
fo -> sec = 0; // The sector in the cluster.
fo -> pos = 0; // The byte in the sector.
// Determine the LBA of the file's current cluster.
l = Cluster2Sector(dsk, fo -> ccls);
// Read the cluster's first sector into the DISK structure's buffer member.
if ( SectorRead( l, dsk -> buffer) != sdcValid)
error = CE_BAD_SECTOR_READ;
// Set the FILE structure's flags.
fo -> Flags.FileWriteEOF = FALSE;
if (type == 'w' || type == 'a')
{
// Open the file for writing or appending.
fo -> Flags.write = 1;
}
else
{
// Open the file for reading.
fo -> Flags.write = 0;
}
} // End: a file was found.
} // End: the media is available.
return (error);
}
Search WWH ::




Custom Search