Re: Creating arbitrary length file using unbuffered IO???
From: Gary G. Little (gglittle.nospam_at_sbcglobal.net)
Date: 08/14/04
- Next message: Brian Catlin: "Re: any simple sample code of display filter driver?"
- Previous message: Carl Woodward: "Re: Kernel Mode vs. User Mode"
- In reply to: Jean Cyr: "Creating arbitrary length file using unbuffered IO???"
- Next in thread: Alexander Grigoriev: "Re: Creating arbitrary length file using unbuffered IO???"
- Reply: Alexander Grigoriev: "Re: Creating arbitrary length file using unbuffered IO???"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 14 Aug 2004 19:19:40 GMT
Of course you can have an arbitrary file size. However, the media to which
you write any given sized data is constrained to store your data in a
physical representation. If it is an HDD, then you must store your
arbitrarily sized file to a sequence of fixed size sectors on that HDD. You
may create a file containing "REM HELLO WORLD" that only occupies 11 bytes,
and if you look at the file size using DIR or explorer it will say 11 bytes.
However, when you write that to disc it will OCCUPY a minimum of 512 bytes
or the minimum amount of data you can access on typical HDD media. Windows
and NTFS typically group HDD sectors into a cluster, so that 11 byte batch
file will typically occupy SECTOR SIZE times SECTORS per CLUSTER. In a FAT
system on a 1 GIG HDD, that 11 bytes could easily tie up 64K of media space.
Anytime you access that file the minimum you can access is that cluster
size, so in the example given, the disc controller will transfer 64k to and
from memory.
-- The personal opinion of Gary G. Little "Jean Cyr" <jcyr@online.nospam> wrote in message news:%23vwVpJZgEHA.1356@TK2MSFTNGP09.phx.gbl... > Not sure if this group is the appropriate place for this posting but I could not > find an more appropriate group. > > The Windows SDK docs state that when using unbuffered output the length > of the buffer to be written must be a multiple of the sector size of the device > where the file is being written. Furthermore the buffer must be written starting > at an offset in the file that is also a multiple of the sector size. This > implies that the size of a file thusly created must also be a multiple of the > sector size. > > I find it hard to accept that an arbitrary size file cannot be created using > unbuffered IO! Is that indeed the case, or am I missing something? > > > Jean Cyr > > /* Time ain't money when all you got is time. */
- Next message: Brian Catlin: "Re: any simple sample code of display filter driver?"
- Previous message: Carl Woodward: "Re: Kernel Mode vs. User Mode"
- In reply to: Jean Cyr: "Creating arbitrary length file using unbuffered IO???"
- Next in thread: Alexander Grigoriev: "Re: Creating arbitrary length file using unbuffered IO???"
- Reply: Alexander Grigoriev: "Re: Creating arbitrary length file using unbuffered IO???"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|