Thread: How to confirm there're holes in a file on windows?

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    48

    How to confirm there're holes in a file on windows?

    I used the C standard I/O `fseek' to create a file which had 50% holes in it. BUT I don't know how to confirm this on Windows. With the same source code compiled on Linux, and then to use `du' and `ls -l' commands I can tell there are holes in the created file (`du' shows almost half size of `ls -l'). On windows, Unfortunately, right click the file, select properties, "size" and "size on disk" are nearly same. So I'm not sure about the holes really exist. Anyone can help? How to check?
    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    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
    Registered User
    Join Date
    Mar 2009
    Posts
    48
    Quote Originally Posted by Salem View Post
    Hi Salem, Thank you very much!! Finally I created a sparse file.
    By the way, if anyone interested in this find `DeviceIoControl' returns 0, try `0x000900C4' instead of `FSCTL_SET_SPARSE'.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  4. Script errors - bool unrecognized and struct issues
    By ulillillia in forum Windows Programming
    Replies: 10
    Last Post: 12-18-2006, 04:44 AM
  5. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM