Thread: whats the difference between 0xFF8 - 0xFFF (Last cluster in file) in FAT12

  1. #1
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497

    whats the difference between 0xFF8 - 0xFFF (Last cluster in file) in FAT12

    hello all , as you see in FAT12 , it says 0xFF8 - 0xFFF are used to indicate the Last cluster in file, my question is , why do we have this range for specifing the end of file!!? we could easily use 0xFFF as the indicator , then having this said ,the 0xff8 is in vein and useless !
    i would be very thankful if anyone help me get this ,
    thank you in advance
    Last edited by Masterx; 06-22-2010 at 01:01 PM.
    Highlight Your Codes
    The Boost C++ Libraries (online Reference)

    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.."
    Bill Bryson


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    My guess is somewhere in the process, the bottom 3 bits are masked out for something else.

    So in effect, all those values do actually mean the same thing when you actually get to use them.

    Say
    if ( ( cluster & 0xFF8 ) == 0xFF8 )
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497
    Quote Originally Posted by Salem View Post
    My guess is somewhere in the process, the bottom 3 bits are masked out for something else.

    So in effect, all those values do actually mean the same thing when you actually get to use them.

    Say
    if ( ( cluster & 0xFF8 ) == 0xFF8 )
    Thank you very much dear Salem,
    but could it also be that because 0xFF8-0xFFF equals 4088-4095 which exceeds the number of actual clusters usable in Fat12 structure ?
    i mean because starting from 0xFF8 means the cluster you are looking for doesn't exist , ( or you have passed the boundary which specifies the last usable cluster in FAT12)
    (cluster counts is 4078(0xfee) under windows, and 4084(0xff4) under linux)
    we have 0x000 to 0xFFF as the range for our addresses ,and according to below:
    FAT12-------------Description
    0x000-------------Free Cluster
    0x001-------------Reserved value; do not use
    *0x002–0xFEF----- Used cluster;value points to next cluster(so this means usable clusters are up to 4078, the rest are for other purposes as you see below)
    0xFF0–0xFF6-------Reserved values; do not use
    0xFF7---------------Bad sector in cluster or reserved cluster
    0xFF8–0xFFF--------Last cluster in file(and what remains is used to specify the end of file , actually it is used to say that you have passed the last usable cluster )


    *: this actually says for addressing our clusters we have 0x002 up to 0xFEE choices.
    starting from FF0 , we address special cases , up till FF8,
    From FF8 to the very end of usable addressing range which is FFF , we use the values to say what you are looking for does not exist , or there are only <FEF number of clusters you could use, now the number you specified is not in that range ,so we use it to say you reached your end of file.
    Last edited by Masterx; 06-25-2010 at 04:41 AM.
    Highlight Your Codes
    The Boost C++ Libraries (online Reference)

    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.."
    Bill Bryson


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  5. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM