Symbian
Symbian OS Library

FAQ-0770 How does SetSize() behave on an LFFS drive?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Development
Created: 01/28/2002 Modified: 01/30/2002
Number: FAQ-0770
Platform: Symbian OS v6.1

Question:
Behaviour of SetSize on LFFS is not the same as FAT.

Answer:
Under the FAT filesystem, calling SetSize() will reserve disk space even if no data has been written into the file. This is useful as a quick way of filling a disk, and also as a way of reserving guaranteed file space.

    SetSize() does not work like this on an LFFS drive. LFFS supports sparse files, which means that if you don't actually write any data to a section of a file, it won't use any Flash space. LFFS will fill in the empty region with zeros if you try to read it back.

    So when you call SetSize on a file on LFFS, all you are doing is changing the file length word in the directory entry. It won't use any space until you write real data to it.

    Unlike FAT, you can't use SetSize on LFFS to reserve space in a file for later. Calling SetSize doesn't guarantee that you can write that amount of data to the file.

    If you want to fill an LFFS drive, or reserve space in a file, you have to write dummy data into the file.