• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

FAT32 Question

It uses at least one file allocation unit.

The first allocation unit is required for the file itself. Additional file allocation units are used for the Long File Name, one for every 13 characters or part thereof over the regular 8.3 file name.
 
That's just the space on the directory table. I think he meant something else. Does a 0-byte file use allocation space not including the directory? (I would guess yes but that's just a guess)
 
I just had the idea of doing something like this to find out:

I made two files using MS Edit in DOS. One was test0.txt. I saved it as empty. The other is test1.txt. I hit space once and saved that one.

Then I issued this command:

DIR /v > test.txt

Test.txt looked like this:
Volume in drive C has no label
Volume Serial Number is 134F-19FD
Directory of C:\TEST
File Name Size Allocated Modified Accessed Attrib


. <DIR> 05-19-03 10:40p 05-19-03 D .
.. <DIR> 05-19-03 10:40p 05-19-03 D ..
TEST0 TXT 0 0 05-19-03 10:41p 05-19-03 A test0.txt
TEST TXT 0 0 05-19-03 10:49p 05-19-03 A test.txt
TEST1 TXT 3 4,096 05-19-03 10:41p 05-19-03 A test1.txt
3 file(s) 3 bytes
2 dir(s) 4,096 bytes allocated
1,865,256,960 bytes free
3,226,464,256 bytes total disk space, 42% in use

Yeah, small drive. I got it in the garbage. 😎

The text formatting makes it hard to read, but you can see that test1.txt totals 3 bytes (my mistake... I'm guessing CR and LF?) and test0.txt totals 0. File test1.txt uses a whole 4k allocation unit, but test0.txt uses 0.

The conclusion is that a 0-byte file uses no file allocation units. (ignoring the FAT itself... file names, etc.)

The test.txt file is here for your viewing pleasure. 😀
 
Originally posted by: kevinthenerd
...but you can see that test1.txt totals 3 bytes (my mistake... I'm guessing CR and LF?)

I'm gonna use a hex editor and an ASCII table to find out what those two mysterious bytes are. I have some theories: null, CR, LF, extra space, etc.
 
The hex editor showed this:

20 0D 0A

20 = 32 = Space
0D = 13 = CR = Carriage Return
0A = 10 = LF = Line Feed

I guess I was right. MS Edit is pretty stupid to add that, IMHO.
 
A zero byte file in FAT uses zero allocation units. However, it increases the size of the directory it's in, by 40 bytes for an 8.3 filename IIRC, more for a long filename, possibly causing the directory to take an extra allocation unit.
 
Back
Top