Header: Boot Sector
To use it, first declare afat_boot_sector
structure, then usefread()
to read the first n bytes of data to that structure, wheren
is the size offat_boot_sector
structure. After reading all the parameters are read into the variables respectively.
Getting the information
The following can be retrieved directly from the structure:
Number of FATs (
fats
)Number of sectors per cluster (
sec_per_clus
)Number of Reserved Sector(
reserved
)
And the following information requires some manipulations/calculations
Bytes Per Sector (
sector_size[0] + sector_size[1] << 8
)First FAT Starting Position (Bytes Per Sector * Number of Reserved Sector)
Data Area Starting Position (Bytes Per Sector * (Number of Reserved Sector + Number of FATs *
fat_length
))
Here, fat_length
is the number of sectors per FAT.
Last updated
Was this helpful?